title: AADSTS700016: Application with identifier 'some_id' was not found in the directory 'some_another_id'
body: <p><img src="https://i.stack.imgur.com/g8nEP.png" alt="here is an error img" /></p>
  <p>I need a federated authentication with custom policy (when user authenticated I need him to appear marked as Federated in b2c users, not Others or something else what I could achieve with single tenant), I had it before with default policy setup in azure as OpenId provider, but did not find how to do FEDERATION Authentication with OpenId in custom policy, so I did it with SAML and below what I've got.</p>
  <p>I tried Single tenant and it is not what I need. Also problem is not with signing key, because I've already had this issue and resolved this. I created self signed certificate, uploaded it to AAD application first and to b2c policy keys after.
  I think the application which authenticate the federation is not an issue, because I works with default policy.</p>
  <pre class="lang-xml prettyprint-override"><code>    &lt;TechnicalProfile Id=&quot;Office-SAML2&quot;&gt;
        &lt;DisplayName&gt;Microsoft Office 365&lt;/DisplayName&gt;
        &lt;Description&gt;Login with your ADFS account&lt;/Description&gt;
        &lt;Protocol Name=&quot;SAML2&quot;/&gt;
        &lt;Metadata&gt;
          &lt;Item Key=&quot;WantsSignedRequests&quot;&gt;false&lt;/Item&gt;
          &lt;Item Key=&quot;PartnerEntity&quot;&gt;https://login.microsoftonline.com/&lt;b2c tenant id&gt;/federationmetadata/2007-06/federationmetadata.xml&lt;/Item&gt;
          &lt;Item Key=&quot;XmlSignatureAlgorithm&quot;&gt;Sha256&lt;/Item&gt;
        &lt;/Metadata&gt;
        &lt;CryptographicKeys&gt;
          &lt;Key Id=&quot;SamlAssertionSigning&quot; StorageReferenceId=&quot;B2C_1A_SamlCert&quot;/&gt;
          &lt;Key Id=&quot;SamlMessageSigning&quot; StorageReferenceId=&quot;B2C_1A_SamlCert&quot;/&gt;
        &lt;/CryptographicKeys&gt;
        &lt;OutputClaims&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;issuerUserId&quot; PartnerClaimType=&quot;userPrincipalName&quot; /&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;givenName&quot; PartnerClaimType=&quot;given_name&quot;/&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;surname&quot; PartnerClaimType=&quot;family_name&quot;/&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;email&quot; PartnerClaimType=&quot;email&quot;/&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;displayName&quot; PartnerClaimType=&quot;name&quot;/&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;identityProvider&quot; DefaultValue=&quot;https://sts.windows.net/&lt;b2c tenant id&gt;/&quot; AlwaysUseDefaultValue=&quot;true&quot; /&gt;
          &lt;OutputClaim ClaimTypeReferenceId=&quot;authenticationSource&quot; DefaultValue=&quot;socialIdpAuthentication&quot; AlwaysUseDefaultValue=&quot;true&quot; /&gt;
        &lt;/OutputClaims&gt;
        &lt;OutputClaimsTransformations&gt;
          &lt;OutputClaimsTransformation ReferenceId=&quot;CreateRandomUPNUserName&quot;/&gt;
          &lt;OutputClaimsTransformation ReferenceId=&quot;CreateUserPrincipalName&quot;/&gt;
          &lt;OutputClaimsTransformation ReferenceId=&quot;CreateAlternativeSecurityId&quot;/&gt;
          &lt;OutputClaimsTransformation ReferenceId=&quot;CreateSubjectClaimFromAlternativeSecurityId&quot;/&gt;
        &lt;/OutputClaimsTransformations&gt;
        &lt;UseTechnicalProfileForSessionManagement ReferenceId=&quot;SM-Noop&quot;/&gt;
      &lt;/TechnicalProfile&gt;
  </code></pre>
  <p>I have been doing everything through this reference
  <a href="https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-custom-setup-adfs2016-idp" rel="noreferrer">https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-custom-setup-adfs2016-idp</a></p>