Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posting back response to bot - Access has been blocked by Conditional Access policies. The access policy does not allow token issuance. #6759

Open
brijshah2709 opened this issue Mar 8, 2024 · 4 comments
Assignees
Labels
bug Indicates an unexpected problem or an unintended behavior.

Comments

@brijshah2709
Copy link

brijshah2709 commented Mar 8, 2024

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

4.21.0

Describe the bug

When bot is created with single tenant config and call is made to following

await turnContext.TurnState.Get<UserTokenClient>().GetSignInResourceAsync(ssoConnectionName,
                turnContext.Activity as Activity,
                finalRedirect: null,
                cancellationToken
           ).ConfigureAwait(false);

It throws error Failed to acquire token for client credentials. (AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance. Trace ID: 4d3115e2-773f-413d-ac57-9a69025d2e00 Correlation ID: 37810be3-b3dd-4f6a-9e87-5bab1e14d910 Timestamp: 2024-03-07 23:05:36Z)

To Reproduce

Create a bot with single tenant config

image

Make a call to GetSignInResourceAsync with SSO connection, test this call on external tenant not on the same tenant where bot is registered. The AAD app backed by BOT is also AzureADMyOrg

Expected behavior

Should return sign in link

Screenshots

Exception added above

Additional context

Bot is created in MSFT tenant and trying to test on external test tenant.

@brijshah2709 brijshah2709 added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Mar 8, 2024
@tracyboehrer tracyboehrer removed the needs-triage The issue has just been created and it has not been reviewed by the team. label Mar 8, 2024
@brijshah2709
Copy link
Author

Can not repro anymore, maybe it was delay from multi-tenant to single tenant migration.

@brijshah2709
Copy link
Author

brijshah2709 commented Mar 29, 2024

@ceciliaavila we are seeing this issue again. It is intermittent but now it is happening on various flows when service try to post back response to the bot.

From latest repro:

(AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance. Trace ID: efe17f44-1a9c-487f-9db5-d906af054800 Correlation ID: c5de5c5f-1a54-4338-974b-c8cb9bd91133 Timestamp: 2024-03-19 00:50:09Z)

On just using happy path scenarios like ME search, LU and at motioned commands. [Updated title to reflect same]

@brijshah2709 brijshah2709 reopened this Mar 29, 2024
@brijshah2709 brijshah2709 changed the title GetSignInResourceAsync thows error Failed to acquire token for client credentials Posting back response to bot - Access has been blocked by Conditional Access policies. The access policy does not allow token issuance. Mar 29, 2024
@sw-joelmut
Copy link
Collaborator

Hi @brijshah2709,

We investigated about this issue and found that it is related to how the AAD have the Conditional Access policies configured.
We found the following information that could be helpful for this case:

  • Similar issue (link)
  • Troubleshot sign-in with Conditional Access (link)
  • List of AADSTS error codes (link)
    image

Additionally, we tried reproducing the issue by using two different tenants, but we couldn't reproduce the error, both Bot and UserTokenClient.GetSignInResourceAsync method worked fine, the Bot responding to messages, and the method returning the URL with the sign in code.

@brijshah2709
Copy link
Author

@sw-joelmut thank you for your response. I understand the issue is from CA but how can I use claims from CA to populate user to go through auth challenge for successful token acquisition? this is coming from common bot SSO code which is required to trigger SSO on initial flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior.
Projects
None yet
Development

No branches or pull requests

4 participants