title: keycloak integration with Azure AD for webapp authentication
body: <p>I am trying to use keycloak for saml broking between my web application and IDP Azure AD.</p>
  
  <p>I have created few users in Azure AD and added my webapp as Application there.
  I have configured KeyCloak with SAML IDP and imported Azure AD federation data in Keycloak.</p>
  
  <p>But somewhere something is wrong as I did not get any link on web which can give me step by step process to integrate KeyCloak with Azure AD.</p>
  
  <p>I am getting Microsoft login page and on putting password authentication is getting passed but then I get the following error before it redirects back to Keycloak:</p>
  
  <blockquote>
    <p>Sorry, but we’re having trouble signing you in.</p>
    
    <blockquote>
      <p>AADSTS700016: Application with identifier
      '<a href="http://localhost:8280/auth/realms/localRealm" rel="nofollow noreferrer">http://localhost:8280/auth/realms/localRealm</a>' was not found in the
      directory '&lt;>'. This can happen if
      the application has not been installed by the administrator of the
      tenant or consented to by any user in the tenant. You may have sent
      your authentication request to the wrong tenant.</p>
    </blockquote>
  </blockquote>
  
  <p>I used the below 2 links to do the configuration:</p>
  
  <p><a href="https://ultimatesecurity.pro/post/okta-saml/" rel="nofollow noreferrer">https://ultimatesecurity.pro/post/okta-saml/</a>  This link describes how to configure Keycloak with Okta for SAML</p>
  
  <p><a href="https://docs.pivotal.io/p-identity/1-5/azure/config-azure.html" rel="nofollow noreferrer">https://docs.pivotal.io/p-identity/1-5/azure/config-azure.html</a>  This link describes how to configure Azure AD as SAML IDP</p>
  
  <p>Edit: It looks like Keycloak is sending wrong application identifier in SAML (maybe) as this localhost:8280... is Keycloak Realm URL and not the Azure Application Identifier which is some string key in Azure -> Applications</p>