0
votes

Does anybody know how to call AcquireToken from a web server for an endpoint that is not the tenantId that the server is associated with?

I am trying to get an Azure Management token from https://login.windows.net/XXX/ where XXX is not my tenantId. This only works if i use the AcquireToken version that prompts for credentials however thats not possible from a web server.

Specifically, CloudContext.Clients.CreateResourceManagementClient requires a SubscriptionCloudCredentials. The resource is https://management.azure.com, the subscriptions ActiveDirectoryTenantId is not the same as the tenantId of my application.

How can i get the token from another tenant without it prompting me for credentials?

1

1 Answers

0
votes

Tokens only work within the boundaries of their own tenant - there is no easy way of doing it today. The only way I can think of is using a hidden frame for requesting the token you want - if the user for the other tenant has an active session with AAD, you can successfully conclude the token acquisition without showing any Ux. Currently there are no samples showing how to do it.