In this walkthrough, we will do Azure CLI Login using GitHub Actions
- Create AD App
- Login to Azure subscription. Create a service principal with a secret.
- Copy the json output of the command for creating the secret
az ad sp create-for-rbac --name "githubActions" --role contributor --scopes /subscriptions/<subscripionId>/resourceGroups/<rgName> --sdk-auth

- Create GitHub Secret
- Login to GitHub, and browse to the setting for your repo.
- Go to Secrets, click New repository secret
- Create secret name AZURE_CREDENTIALS
- Paste the value you copied when creating AD App

- Create Workflow
- Browse to Actions.
- You can select sample workflow templates or click on “set up a workflow yourself”

- Copy the code to the workflow
# This is a basic workflow to help you get started with Actions
on: [push]
name: AzureDemo
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- run: |
az account show

- Commit the change to repo

- Go to Actions

- Click on the running job to see the status/output
