Search code examples
javaazureazure-management-api

Is it possible for one azure clientID to be accessed by multiple users?


Can we set Azure AD permission so it can be accessed by any user? For instance I have one clientID within my UserA. Then UserB who is outside my organization will be able to authenticate using clientID of UserA. I think this is possible by setting my app as multi-tenant but not sure what exact permission I need to grant? The permission issue occurs when I'm initializing the Azure: Azure azure = Azure.authenticate(creds).withDefaultSubscription();


Solution

  • I think the issue is the user needs to consent the appid, is there a way to automate that?

    No, you can't automate that. You need to send an interactive authorization request for this user and resource.

    The problem you are running in to is that the tenant you are using to access your app has not added your application to the list of applications that are supported. It's telling you to use the interactive flow as an administrator.

    Consent is a two step process:

    1) First, the administrator of the tenant must approve the app. This can be done either a) in the Azure portal of the tenant wishing to use the app b) by launching the app and using admin credentials against the app when you sign in.

    2) Second, any additional user (non-admin) will be promoted to consent for their individual information when using the app for the first time after the admin has consented that the app can be used.

    For more details about how to sign in user with multiple tenant you could refer to this article.