I'm trying to create a GitHub action that deploys infra and my system to Azure. To log in, I use an azure login action like so:
- name: Azure Login
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
To be able to do this, you must first create a service principal in Azure and store the secrets as a secret in your GitHub repo. I neatly created an sp using the az ad sp create-for-rbac command and defined enough permissions and all (as described here), however... I cannot use the --sdk-auth flag anymore because it's deprecated. I don't know if this flag makes a difference, but there is a difference in the JSON object the Azure CLI outputs compared to previous versions. The (JSON) object this commands outputs looks like so:
{
"appId": "guid",
"displayName": "Name I gave the app in the az ad sp create for RBAC command",
"name": "guid",
"password": "very-secret-string",
"tenant": "guid"
}
This seems to be some sort of a new object because, in previous versions, the object looked slightly different. The previous version of the AZ CLI outputs an object that looks like this:
{
"clientId": "guid",
"clientSecret": "super-secret-string",
"subscriptionId": "guid",
"tenantId": "guid"
}
Now, as a result, the login action in my GH Actions workflow doesn't work anymore and I desperately need it ;)
I also tried to create a Federated Credential, but without a result. Now, I'm out of ideas to be honest and I could use some differenty insights.
CodePudding user response:
It looks like there was an issue with the Azure CLI versions installed on the workers.
According to the GH issue, this has been resolved now and shouldn't occur in the future anymore: https://github.com/Azure/cli/issues/56#issuecomment-965186851
Released a long term fix for any further mismatch issues. Now the default value for azcliversion dynamically points to the version installed on agent. So there will be no mismatch again unless someone explicitly mentions latest. If for some reason there is no version of az cli on the agent then action fall backs to latest.
Most of the hosted agents are also updated to 2.30.0.
Please test your scenarios and let us know if you face any more issues.
