Merge pull request #322 from MoChilia/fix-readme

Fix format error
This commit is contained in:
Shiying Chen
2023-05-25 10:20:17 +08:00
committed by GitHub
3 changed files with 16 additions and 15 deletions

View File

@@ -28,7 +28,6 @@ Note:
## Sample workflow that uses Azure login action to run az cli ## Sample workflow that uses Azure login action to run az cli
```yaml ```yaml
# File: .github/workflows/workflow.yml # File: .github/workflows/workflow.yml
on: [push] on: [push]
@@ -53,7 +52,6 @@ jobs:
## Sample workflow that uses Azure login action to run Azure PowerShell ## Sample workflow that uses Azure login action to run Azure PowerShell
```yaml ```yaml
# File: .github/workflows/workflow.yml # File: .github/workflows/workflow.yml
on: [push] on: [push]
@@ -92,18 +90,20 @@ jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 'Az CLI login' - name: Az CLI login
uses: azure/login@v1 uses: azure/login@v1
with: with:
client-id: ${{ secrets.AZURE_CLIENT_ID }} client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Run az commands' - name: Azure CLI script
run: | uses: azure/CLI@v1
az account show with:
az group list azcliversion: latest
pwd inlineScript: |
az account show
az group list
``` ```
Users can also specify `audience` field for access-token in the input parameters of the action. If not specified, it is defaulted to `api://AzureADTokenExchange`. This action supports login az powershell as well for both Windows and Linux runners by setting an input parameter `enable-AzPSSession: true`. Below is the sample workflow for the same using the Windows runner. Please note that powershell login is not supported in macOS runners. Users can also specify `audience` field for access-token in the input parameters of the action. If not specified, it is defaulted to `api://AzureADTokenExchange`. This action supports login az powershell as well for both Windows and Linux runners by setting an input parameter `enable-AzPSSession: true`. Below is the sample workflow for the same using the Windows runner. Please note that powershell login is not supported in macOS runners.
@@ -146,6 +146,8 @@ Refer to the [Azure PowerShell](https://github.com/azure/powershell) GitHub Acti
## Sample to connect to Azure US Government cloud ## Sample to connect to Azure US Government cloud
```yaml ```yaml
# File: .github/workflows/workflow.yml
- name: Login to Azure US Gov Cloud with CLI - name: Login to Azure US Gov Cloud with CLI
uses: azure/login@v1 uses: azure/login@v1
with: with:
@@ -162,10 +164,9 @@ Refer to the [Azure PowerShell](https://github.com/azure/powershell) GitHub Acti
Refer to the [Azure PowerShell](https://github.com/azure/powershell) GitHub Action to run your Azure PowerShell scripts. Refer to the [Azure PowerShell](https://github.com/azure/powershell) GitHub Action to run your Azure PowerShell scripts.
## Sample Azure Login workflow that to run az cli on Azure Stack Hub ## Sample Azure Login workflow that uses Azure login action to run az cli on Azure Stack Hub
```yaml ```yaml
# File: .github/workflows/workflow.yml # File: .github/workflows/workflow.yml
on: [push] on: [push]

View File

@@ -1,6 +1,6 @@
# Login to Azure subscription # Login to Azure subscription
name: 'Azure Login' name: 'Azure Login'
description: 'AuthenticatetoAzure using OIDCandrunyourAzCLIorAzPowerShellbasedActionsorscripts.github.com/Azure/Actions' description: 'Authenticate to Azure using OIDC and run your Az CLI or Az PowerShell based actions or scripts. github.com/Azure/Actions'
inputs: inputs:
creds: creds:
description: 'Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS' description: 'Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS'
@@ -15,7 +15,7 @@ inputs:
description: 'Azure subscriptionId' description: 'Azure subscriptionId'
required: false required: false
enable-AzPSSession: enable-AzPSSession:
description: 'SetthisvaluetotruetoenableAzurePowerShellLogininadditiontoAzCLIlogin' description: 'Set this value to true to enable Azure PowerShell Login in addition to Az CLI login'
required: false required: false
default: false default: false
environment: environment:
@@ -23,7 +23,7 @@ inputs:
required: false required: false
default: azurecloud default: azurecloud
allow-no-subscriptions: allow-no-subscriptions:
description: 'Setthisvaluetotrueto enable support for accessing tenants without subscriptions' description: 'Set this value to true to enable support for accessing tenants without subscriptions'
required: false required: false
default: false default: false
audience: audience:

View File

@@ -211,10 +211,10 @@ async function main() {
} }
catch (error) { catch (error) {
if (!isAzCLISuccess) { if (!isAzCLISuccess) {
core.setFailed(`Az CLI Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); core.setFailed(`Az CLI Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows`);
} }
else { else {
core.setFailed(`Azure PowerShell Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); core.setFailed(`Azure PowerShell Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows`);
} }
} }
finally { finally {