-
Notifications
You must be signed in to change notification settings - Fork 435
Update azure/CLI@v1 to azure/cli@v2 and azure/powershell@v1 to azure/powershell@v2
#438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+34
−37
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespaces are removed for consistency. |
||
| 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: | | ||
|
|
@@ -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: | ||
|
|
@@ -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,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: | | ||
|
|
@@ -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: | | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation according to https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-cloud-providers#adding-permissions-settings