Im trying to deploy from github actions using the following yml:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
client-id: GUID
tenant-id: GUID
subscription-id: GUID
but im getting the error: Please check the credentials and make sure az is installed on the runner.
If i change to creds
with the json, i get that the credentials are incorrect.
This is how i build the json:
az ad sp create-for-rbac -n "{ADD YOU NAMEW HERE}" --role Contributor --scopes /subscriptions/{subscriptionId} --sdk-auth
thanks
2
Answers
One of the workaround you can follow to resolve the above issue;
If your project is ready on the GitHub make sure to update the same in your local environment the
example.yml
file and push them. After creation of credentials usingaz ad sp create-for-rbac
. Store those value into a secret file and pass this as variable in theexample.yml
file and try to execute as below.For more information Please refer this GitHub MarketPlace|GitHub Actions for deploying to Azure and this TechCommunity Blog|How to login to Azure with GitHub Actions by @Alfredo Deza.
if you run this command it should work
it will output a json payload, put that json payload in the your repo’s secret and then call it in your yaml file