The first step is to create an Azure Service Principal account. You'll need the following:
- An Azure subscription ID (find it here) or follow this guide.
- A Service Principal with the following details the AppID, password, and tenant information. Create one with:
az ad sp create-for-rbac --name "CICD" --role contributor --scopes /subscriptions/$AZURE_SUBSCRIPTION_ID --sdk-auth
Replace "$AZURE_SUBSCRIPTION_ID" with the id from step 1.
Next, in your GitHub repository, add the output from the Service Principal (should be a JSON blob) as an Action Secret. You do this in your repository Settings.
Finally, create a GitHub workflow file by going to the "Actions" tab. Make sure you use the Azure login action:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
The full running example is in the sample GitHub repository which you can use to get started, or use the YouTube video for a detailed walk-through!
Useful resources:
- Sample GitHub repository
- Create an Azure Service Principal
- Install Azure CLI
- Free Azure Certification for Students
- Introduction to GitHub Actions
All of the steps are also covered in this short video:
Updated Jul 14, 2022
Version 1.0alfredodeza
Microsoft
Joined September 24, 2021
Educator Developer Blog
Follow this blog board to get notified when there's new activity