Azure Bicep #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://learn.microsoft.com/ja-jp/azure/azure-resource-manager/bicep/deploy-github-actions | |
name: Azure Bicep | |
on: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
deploy-bicep: | |
runs-on: ubuntu-latest | |
environment: Production | |
defaults: | |
run: | |
working-directory: 'bicep' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Azure CLI | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Create resource group | |
id: resourceGroup | |
run: | | |
RESOURCE_GROUP=rg-bicep-from-actions-$RANDOM | |
echo "group-name=$RESOURCE_GROUP" >> $GITHUB_OUTPUT | |
az group create --name $RESOURCE_GROUP --location japaneast | |
- name: Deploy Bicep | |
uses: azure/arm-deploy@v2 | |
with: | |
scope: resourceGroup | |
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} | |
resourceGroupName: ${{ steps.resourceGroup.outputs.group-name }} | |
template: ./main.bicep | |
parameters: 'storagePrefix=yuta storageSKU=Standard_LRS' | |
failOnStdErr: false | |
- name: Az CLI Logout | |
run: az logout |