Reputation: 16148
I am running an Azure App Service with one User-assigned identity (and no system-managed identity):
Is there a way inside the app (i.e. my custom code) to retrieve the clientId of the identity? Or do I need to set that in a app setting to be available inside the app?
Question comes from the fact that I want to use this identity to authenticate using an AzureCredential and it needs the clientId.
Or is the better way to use MSI and set the app setting AzureServicesAuthConnectionString?
Upvotes: 0
Views: 416
Reputation: 58783
Looking at environment variables in an App Service with a User assigned Managed Identity, there is nothing that contains the id.
So you should set the id as an App Setting on the app, and use it. I definitely recommend that you use AzureCredential as it is the newer one. The older AzureServiceTokenProvider would not give you any advantage over it anyway.
Upvotes: 1