Hi,
I am trying to write a script that will grant admin consent to application permissios:
provisioner “local-exec” {
command = <<-GRANTCONSENTCMD
az rest --method POST
–uri ‘https://graph.microsoft.com/v1.0/oauth2PermissionGrants’
–headers ‘Content-Type=application/json’
–body ‘{
“clientId”: “{self.triggers.clientId}",
"consentType": "AllPrincipals",
"principalId": null,
"resourceId": "{self.triggers.resourceId}”,
“scope”: “${self.triggers.scope}”
}’
GRANTCONSENTCMD
}
However, when I am going to issue terraform apply I am getting the below error. I already installed the Az module. May I ask for your help why I am getting this error?
Error running command 'az rest --method POST
│ --uri ‘https://graph.microsoft.com/v1.0/oauth2PermissionGrants’
│ --headers ‘Content-Type=application/json’
│ --body ‘{
│ “clientId”: “xxxxxaxx-xxxx-xxxa-bxdx-xx61bxcx628b”,
│ “consentType”: “AllPrincipals”,
│ “principalId”: null,
│ “resourceId”: “xx0xxxxx-bdef-4463-88db-98f22de89214”,
│ “scope”: “Directory.Read.All”
│ }’
│ ': exit status 1. Output: ‘az’ is not recognized as an internal or external command,
│ operable program or batch file.