Azure B2C - Error on 'GetAndInitializeTenantPolicy' in Custom Policy

Blair, Jackson 20 Reputation points
2025-05-27T04:29:33.3866667+00:00

Hi there!

I'm trying to get a custom policy for Azure b2c to work. The issue i'm having (according to the Tenant Audit Logs) is that when this endpoint is hit in the process, it throws an access denied error.

The url:

At the stage in the policy where it tries to Initialize the tenant, i get an access error. It looks like it gets up the part of the policy where its the above endpoint, and then the error pops up. I can see it in the audit logs.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. Sanoop M 4,310 Reputation points Moderator
    2025-05-30T02:17:47.88+00:00

    Hello @Blair, Jackson,

    I'm glad to know that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Issue:

    When you are trying to setup a custom policy named GetAndInitializeTenantPolicy in Azure AD B2C tenant and you are getting Access denied error.

    The url:

    At the stage in the policy where it tries to Initialize the tenant, you get an access error. It gets up the part of the policy where its the above endpoint, and then the error pops up which is seen in the audit logs.

    Solution:

    Issue resolved by @Blair, Jackson

    It looks like there was a step at the end of the user journey left by a previous developer, which was hitting some external api. This was causing the flow to fail on the last step, because the external api had a permissions issue.

    To fix this issue, you just removed the offending step from the user journey and the flow started functioning again correctly.

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information. Thank you again for your time and patience throughout this issue.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.