I am using Azure Devops Pipeline.
I create a ServiceConnection in Azure Devops and added an Service Principal in it.
Agent i am using is 'ubuntu-latest'
I created a powershell task in pipeline
- task: AzureCLI@2
displayName: 'Assign Role'
name: task_inline
inputs:
scriptType: 'pscore'
azureSubscription: 'AzureConnRM'
scriptLocation: scriptPath
addSpnToEnvironment: true
scriptPath: './abc.ps1'
In Powershell to update an existing RBAC Role i am running below command:
az role assignment update --role-assignment $myjson --debug --verbose
and json which i am passing is
$myjson = '{
"conditionVersion": "",
"roleDefinitionName": "Contributor",
"principalType": "User",
"condition": "",
"id": "/subscriptions/097ca710-067e-4a70-8ce6-494268568148/resourceGroups/Trial-RG/providers/Microsoft.Authorization/roleAssignments/45d7dc3c-4a95-8a1c-bd87-f8a460c6d255",
"resourceGroup": "Trial-RG",
"roleDefinitionId": "/subscriptions/097ca710-067e-4a70-8ce6-494268568148/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c",
"type": "Microsoft.Authorization/roleAssignments",
"scope": "/subscriptions/097ca710-067e-4a70-8ce6-494268568148/resourceGroups/Trial-RG",
"principalId": "8cd5df22-42f4-405e-b3ab-d562eaf1da92",
"canDelegate": "",
"description": "Updated",
"name": "45d7dc3c-4a95-8a1c-bd87-f8a460c6d255"
}'
But get the error:
Error detail: Expecting property name enclosed in double quotes: line 2 column 3 (char 4)