Right now I am using ansible playbooks to create azure resource group on Centos 7.0, and I created a credential file like this:
[default]
subscription_id=my_subscription_id
client_id=<the application ID>
secret=<the password>
tenant=<my aad id>
and it throws an error like this:
{"changed": false, "msg": "Error checking for existence of name ansible-rg - 403 Client Error: Forbidden for url: https://management.azure.com/subscriptions/my_subscription_id/resourcegroups/ansible-rg?api-version=2017-05-10"}
I know maybe it is because my lack permission of my subscription, but I am not sure what I should do about this.
Access control (IAM)
->Add
->Add role assignment
-> add your service principal as a role(e.g. owner) in the subscription. – Joy Wang-MSFT