Skip to content

Commit cf0065b

Browse files
authored
Update README.md to support macOS and self-hosted runners (#92)
* update README.md to support MacOS and self-hosted runner * update README.md * update README.md
1 parent 7f8525f commit cf0065b

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

README.md

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
# GitHub action for Azure PowerShell
2+
23
This repository contains GitHub action for Azure PowerShell to automate your GitHub workflows using Azure PowerShell scripts.
34

45
Get started today with a [free Azure account](https://azure.com/free/open-source)!
56

67
The definition of this GitHub Action is in [action.yml](https://github.com/azure/powershell/blob/master/action.yml).
78

8-
## End-to-End Sample Workflow
9+
> [!NOTE]
10+
> Azure PowerShell action now supports macOS and self-hosted Runners!
911
10-
### Dependencies on other GitHub Actions
12+
## Dependencies on other GitHub Actions
1113

1214
Login to Azure before running Azure PowerShell scripts using [Azure Login](https://github.com/Azure/login). Refer [Azure Login](https://github.com/Azure/login#configure-azure-credentials) action on how to configure Azure credentials.
1315

14-
Once login is done, Azure PowerShell action will use the same session to run the script.
16+
Both [Azure Login](https://github.com/Azure/login) and [Azure PowerShell](https://github.com/azure/powershell) action uses `Az` module.
17+
18+
Once login is done, Azure PowerShell action will use the same session to run the script.
19+
20+
## Sample Workflow
21+
22+
### Sample workflow to run inlineScript
1523

16-
#### Sample workflow to run inlinescript
1724
```yaml
1825
on: [push]
1926

@@ -31,26 +38,25 @@ jobs:
3138
creds: ${{secrets.AZURE_CREDENTIALS}}
3239
enable-AzPSSession: true
3340

34-
- name: Run Azure PowerShell script
41+
- name: Run Azure PowerShell inline script
3542
uses: azure/powershell@v1
3643
with:
3744
inlineScript: |
3845
Get-AzVM -ResourceGroupName "ResourceGroup11"
3946
azPSVersion: "latest"
4047
```
41-
Azure PowerShell Script to be executed can be given under inlineScript as shown in the sample workflow.
4248
43-
Both [Azure Login](https://github.com/Azure/login) and [Azure PowerShell](https://github.com/azure/powershell) action uses Az module.
49+
Azure PowerShell Script to be executed can be given under inlineScript as shown in the sample workflow.
4450
45-
Currently, Azure PowerShell action only supports ubuntu and windows runners. MacOS is not supported. Self hosted runners are not supported.
51+
Azure PowerShell action is now supported for the Azure public cloud as well as Azure government clouds (`AzureUSGovernment` or `AzureChinaCloud`) and Azure Stack (`AzureStack`) Hub. Before running Azure PowerShell scripts, login to the respective Azure Cloud using [Azure Login action](https://github.com/Azure/login) by setting appropriate value for the `environment` parameter.
4652

47-
Azure PowerShell action is now supported for the Azure public cloud as well as Azure government clouds ('AzureUSGovernment' or 'AzureChinaCloud') and Azure Stack ('AzureStack') Hub. Before running Azure PowerShell scripts, login to the respective Azure Cloud using [Azure Login](https://github.com/Azure/login) by setting appropriate value for the `environment` parameter.
53+
Additionally the action supports two optional parameters:
4854

49-
Additionally the action supports two optional parameters
5055
- `errorActionPreference` : select a suitable  value for the variable for executing the script. Allowed values are `stop`, `continue`, `silentlyContinue`. Default is `Stop`.
5156
- `failOnStandardError` : By default this is marked as `false`. But if this is marked as `true`, the action will fail if any errors are written to the error pipeline, or if any data is written to the Standard Error stream.
5257

53-
#### Sample workflow to run a script file in your repository
58+
### Sample workflow to run a script file in your repository
59+
5460
```yaml
5561
# File: ./scripts/run_azps_cmdlets.ps1
5662
on: [push]
@@ -78,16 +84,20 @@ jobs:
7884
inlineScript: ./scripts/run_azps_cmdlets.ps1
7985
azPSVersion: "latest"
8086
```
87+
8188
You have to check out the repository before running the script file.
8289
You can also run the script file with parameters. For example:
90+
8391
```yaml
8492
- name: Run Azure PowerShell Script File
8593
uses: azure/powershell@v1
8694
with:
8795
inlineScript: ./scripts/run_azps_cmdlets.ps1 myresourcegroup myresourcename
8896
azPSVersion: "latest"
8997
```
98+
9099
or
100+
91101
```yaml
92102
- name: Run Azure PowerShell Script File
93103
uses: azure/powershell@v1
@@ -98,13 +108,9 @@ or
98108

99109
### Sample workflow to run Azure powershell actions in Azure US Government cloud
100110

101-
```
102-
.......
103-
.......
104-
.......
105-
111+
```yaml
106112
- name: Login to Azure US Gov Cloud with Az Powershell
107-
uses: azure/login@releases/azcloud-v1
113+
uses: azure/login@v1
108114
with:
109115
creds: ${{ secrets.AZURE_US_GOV_CREDENTIALS }}
110116
environment: 'AzureUSGovernment'
@@ -117,20 +123,22 @@ or
117123
azPSVersion: "latest"
118124
```
119125

120-
#### Available versions of Az Module on runner
126+
## Available versions of Az Module on runner
127+
128+
To use the latest Az module version, specify `latest`. You can find the latest Az module versions on different runner images from this [table](https://github.com/actions/runner-images#available-images).
121129

122-
To use the latest Az module version, specify 'latest'. You can find the latest Az module versions on different runner images from this [table](https://github.com/actions/runner-images#available-images).
130+
Or you can find all supported `Az` version on [PowerShell Gallery](https://www.powershellgallery.com/packages/Az).
123131

124-
# Getting Help for Azure PowerShell Issues
132+
## Getting Help for Azure PowerShell Issues
125133

126-
If you encounter an issue related to the Azure PowerShell commands executed in your script, you can
134+
If you encounter an issue related to the Azure PowerShell commands executed in your script, you can
127135
file an issue directly on the [Azure PowerShell repository](https://github.com/Azure/azure-powershell/issues/new/choose).
128136

129-
# Contributing
137+
## Contributing
130138

131139
This project welcomes contributions and suggestions. Most contributions require you to agree to a
132140
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
133-
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
141+
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
134142

135143
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
136144
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions

0 commit comments

Comments
 (0)