# This workflow deploys Azure automation runbooks into Azure. name: Deploy Kontext automation runbooks on: push: branches: ["master"] paths: - "scripts/automation/**" workflow_dispatch: permissions: contents: read id-token: write jobs: build-and-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 # Login to Azure - uses: azure/login@v1 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} enable-AzPSSession: true # Deploy runbooks - name: Deploy Azure runbooks uses: azure/powershell@v1 with: inlineScript: | pushd ./scripts/runbooks Import-AzAutomationRunbook -Path "myrunbook.ps1" -Name myrunbook -Type PowerShell -AutomationAccountName 'myautomationaccount' -ResourceGroupName 'rg' -Force Publish-AzAutomationRunbook -Name myrunbook -AutomationAccountName 'myautomationaccount' -ResourceGroupName 'rg' popd azPSVersion: "latest" # Logout - name: logout run: | az logout
visibility 37
comment 0
access_time 2 months ago
language English
codeDeploy Azure Automation Runbooks via GitHub Actions
This code snippet shows how to use deploy Azure Automation PowerShell runbooks using GitHub Actions workflow.
Automation Runbooks can be used to run scripts regularly including PowerShell workflows, Python scripts, etc.
If you have multiple scripts to deploy, you can create a PowerShell script file to deploy.
The following assumptions are made:
- The PowerShell runbook script (myrunbook.ps1) is located in the specified folder (scripts/runbooks).
- The runbook is PowerShell type.
- GitHub Actions secrets are setup to use OIDC to authenticate with Azure.
- The resource will be deployed into automation account named
myautomationaccount
under resource group 'rg
'.
Code snippet
copyright
This page is subject to Site terms.
Log in with external accounts
comment Comments
No comments yet.
warning Please login first to view stats information.
article
Github Action Az Automation PowerShell: Object reference not set to an instance of an object
article
Azure Bicep - Allow Azure services and resources to access this resource
article
Azure Bicep Deploy Error - The 'parameters.properties.storageAccountSubscriptionId' segment in the url is invalid.