From 5765d3ec818a6d03e86f7f560a5263b5f5ad6989 Mon Sep 17 00:00:00 2001 From: jiasli <4003950+jiasli@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:49:16 +0800 Subject: [PATCH 1/2] patch --- README.md | 63 ++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 6575ca858..9cad0b6ac 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ on: [push] permissions: id-token: write contents: read -jobs: +jobs: build-and-deploy: runs-on: ubuntu-latest steps: @@ -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: | @@ -215,7 +215,7 @@ on: [push] permissions: id-token: write contents: read -jobs: +jobs: build-and-deploy: runs-on: ubuntu-latest steps: @@ -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: | @@ -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** @@ -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: | @@ -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: | @@ -438,7 +437,7 @@ 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: @@ -446,22 +445,22 @@ jobs: 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: | @@ -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 @@ -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. @@ -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: | From f4560bef6209064179468fb7e13090dfbd2762ff Mon Sep 17 00:00:00 2001 From: jiasli <4003950+jiasli@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:39:51 +0800 Subject: [PATCH 2/2] fix indentation --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9cad0b6ac..beed96b72 100644 --- a/README.md +++ b/README.md @@ -183,8 +183,8 @@ name: Run Azure Login with OIDC on: [push] permissions: - id-token: write - contents: read + id-token: write + contents: read jobs: build-and-deploy: runs-on: ubuntu-latest @@ -213,8 +213,8 @@ name: Run Azure Login with OIDC on: [push] permissions: - id-token: write - contents: read + id-token: write + contents: read jobs: build-and-deploy: runs-on: ubuntu-latest