Skip to content

Commit

Permalink
Update azure/CLI@v1 to azure/cli@v2 and azure/powershell@v1 to …
Browse files Browse the repository at this point in the history
…`azure/powershell@v2` (#438)

* patch

* fix indentation
  • Loading branch information
jiasli authored Apr 26, 2024
1 parent 19d77c4 commit cf8f85d
Showing 1 changed file with 34 additions and 37 deletions.
71 changes: 34 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ name: Run Azure Login with OIDC
on: [push]

permissions:
id-token: write
contents: read
jobs:
id-token: write
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
Expand All @@ -195,9 +195,9 @@ jobs:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
Expand All @@ -213,9 +213,9 @@ name: Run Azure Login with OIDC
on: [push]

permissions:
id-token: write
contents: read
jobs:
id-token: write
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
Expand All @@ -226,16 +226,16 @@ jobs:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true

- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Azure PowerShell script
uses: azure/powershell@v1
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
Expand Down Expand Up @@ -281,18 +281,17 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
```

- **The workflow sample to run both Azure CLI and Azure PowerShell**
Expand All @@ -309,21 +308,21 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true
- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Azure PowerShell script
uses: azure/powershell@v1
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
Expand Down Expand Up @@ -372,29 +371,29 @@ Now you can try the workflow to login with system-assigned managed identity.
name: Run Azure Login with System-assigned Managed Identity
on: [push]
jobs:
jobs:
build-and-deploy:
runs-on: self-hosted
steps:
- name: Azure login
uses: azure/login@v2
with:
auth-type: IDENTITY
auth-type: IDENTITY
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
# Azure CLI Action only supports linux self-hosted runners for now.
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
# Azure CLI Action only supports linux self-hosted runners for now.
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Azure PowerShell script
uses: azure/powershell@v1
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
Expand Down Expand Up @@ -438,30 +437,30 @@ Now you can try the workflow to login with user-assigned managed identity.
name: Run Azure Login with User-assigned Managed Identity
on: [push]

jobs:
jobs:
build-and-deploy:
runs-on: self-hosted
steps:
- name: Azure login
uses: azure/login@v2
with:
auth-type: IDENTITY
client-id: ${{ secrets.AZURE_CLIENT_ID }}
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true

# Azure CLI Action only supports linux self-hosted runners for now.
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
# Azure CLI Action only supports linux self-hosted runners for now.
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Azure PowerShell script
uses: azure/powershell@v1
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
Expand All @@ -482,13 +481,12 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:

- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
environment: 'AzureUSGovernment'
enable-AzPSSession: true

```
### Login to Azure Stack Hub
Expand All @@ -505,13 +503,12 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:

- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
environment: 'AzureStack'
enable-AzPSSession: true

```
Refer to the [Azure Stack Hub Login Action Tutorial](https://learn.microsoft.com/azure-stack/user/ci-cd-github-action-login-cli) for more detailed instructions.
Expand Down Expand Up @@ -542,14 +539,14 @@ jobs:
enable-AzPSSession: true
- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Run Azure PowerShell
uses: azure/powershell@v1
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
Expand Down

0 comments on commit cf8f85d

Please sign in to comment.