Hi @Alex Haigh,
Based on your query, here is my understanding: you have tried performing Mangedidentitycredential
login and received insufficient privileges error.
I see that you have provided the application with relevant permissions to retrieve a token but still you have received an error. The permissions of an application will work the Oauth
flows and will be able retrieve the token as per your requirement. But when you are trying to use Managed identities, you need ensure the application has right permissions on the resources. Only then you will be retrieving the token and will be able to access the resources.
Here is the Microsoft document which you can use as reference in order to work with Managed identities:
- For user assigned Managed identity: Authenticate Azure-hosted .NET apps to Azure resources using a user-assigned managed identity
- For System assigned Managed identity: Authenticate Azure-hosted .NET apps to Azure resources using a system-assigned managed identity
Here is the code implementation in order to retrieve the token using managed identities: Implement the code.
Additional information: Using Managed identity credential Class.
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If the answer is helpful, please click "Accept Answer" and kindly "upvote it". If you have extra questions about this answer, please click "Comment".