Skip to content

GitHub Action for Azure PowerShell

Compare
Choose a tag to compare
@aksm-ms aksm-ms released this 13 May 06:10
· 35 commits to releases/v1 since this release

GitHub action for Azure PowerShell enables to automate your GitHub workflows using Azure PowerShell scripts.

Get started today with a free Azure account!

The definition of this GitHub Action is in action.yml.

End-to-End Sample Workflow

Login to Azure before running Azure PowerShell scripts using Azure Login. Refer Azure Login action on how to configure Azure credentials.

Once login is done, Azure PowerShell action will use the same session to run the script.

###Sample workflow to run inline script using Azure PowerShell

on: [push]

name: AzurePowerShellSample

jobs:

  build:
    runs-on: ubuntu-latest
    steps:
    
    - name: Login via Az module
      uses: azure/[email protected]
      with:
        creds: ${{secrets.AZURE_CREDENTIALS}}
        enable-AzPSSession: true 
        
    - name: Run Azure PS script
      uses: azure/powershell@v1
      with:
        inlineScript: |
          Get-AzVM -ResourceGroupName "MyResourceGroup"
        azPSVersion: '3.1.0'

Azure PowerShell Script to be executed can be given under inlineScript as shown in the sample workflow.