Reputation: 185
I have a requirement to create a key vault in Azure using a power shell. This PS script runs from the pipeline.
$UserObjectId = (Get-AzureRmADUser -SearchString xxxxxxxxxx).Id
I used the above command to get user id but I got the error as
"Insufficient privileges to complete this operation". Do I need to give any permission to the user from which the pipeline executing?
Upvotes: 1
Views: 1528
Reputation: 5296
Yes absolutely , you have to provide permission to the user under you pipeline is running. User should be having Directory.RaadAll, Read All User basic profile permission to read thorugh their profile.
But Ideally you should be running your Azure Devops pipeline using Service Principal and you should provide the permission to your application.
You can refer this link for creating app identity(Service Principal)
Then you can login to the Azure portal and browse through the application and provide the permission under Windows Azure Directory like below:
Check this for further reference:
Hope it helps.
Upvotes: 1