Skip to content

Commit 81e1d9f

Browse files
authored
Update README.md for azure/login@v2 (#423)
* update readme * fix lint error * remove 'en' from link
1 parent c847559 commit 81e1d9f

File tree

1 file changed

+13
-33
lines changed

1 file changed

+13
-33
lines changed

README.md

+13-33
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- [Login to Azure US Government cloud](#login-to-azure-us-government-cloud)
2020
- [Login to Azure Stack Hub](#login-to-azure-stack-hub)
2121
- [Login without subscription](#login-without-subscription)
22-
- [Az logout and security hardening](#az-logout-and-security-hardening)
22+
- [Security hardening](#security-hardening)
2323
- [Azure CLI dependency](#azure-cli-dependency)
2424
- [Reference](#reference)
2525
- [GitHub Action](#github-action)
@@ -190,7 +190,7 @@ jobs:
190190
runs-on: ubuntu-latest
191191
steps:
192192
- name: Azure login
193-
uses: azure/login@v1
193+
uses: azure/login@v2
194194
with:
195195
client-id: ${{ secrets.AZURE_CLIENT_ID }}
196196
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -220,7 +220,7 @@ jobs:
220220
runs-on: ubuntu-latest
221221
steps:
222222
- name: Azure login
223-
uses: azure/login@v1
223+
uses: azure/login@v2
224224
with:
225225
client-id: ${{ secrets.AZURE_CLIENT_ID }}
226226
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -282,7 +282,7 @@ jobs:
282282
runs-on: ubuntu-latest
283283
steps:
284284
285-
- uses: azure/login@v1
285+
- uses: azure/login@v2
286286
with:
287287
creds: ${{ secrets.AZURE_CREDENTIALS }}
288288
@@ -310,7 +310,7 @@ jobs:
310310
runs-on: ubuntu-latest
311311
steps:
312312
313-
- uses: azure/login@v1
313+
- uses: azure/login@v2
314314
with:
315315
creds: ${{ secrets.AZURE_CREDENTIALS }}
316316
enable-AzPSSession: true
@@ -333,7 +333,7 @@ jobs:
333333
If you want to pass subscription ID, tenant ID, client ID, and client secret as individual parameters instead of bundling them in a single JSON object to address the [security concerns](https://docs.github.com/actions/security-guides/encrypted-secrets), below snippet can help with the same.
334334

335335
```yaml
336-
- uses: Azure/login@v1
336+
- uses: azure/login@v2
337337
with:
338338
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
339339
```
@@ -377,7 +377,7 @@ jobs:
377377
runs-on: self-hosted
378378
steps:
379379
- name: Azure login
380-
uses: azure/login@v1
380+
uses: azure/login@v2
381381
with:
382382
auth-type: IDENTITY
383383
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -443,7 +443,7 @@ jobs:
443443
runs-on: self-hosted
444444
steps:
445445
- name: Azure login
446-
uses: azure/login@v1
446+
uses: azure/login@v2
447447
with:
448448
auth-type: IDENTITY
449449
client-id: ${{ secrets.AZURE_CLIENT_ID }}
@@ -483,7 +483,7 @@ jobs:
483483
runs-on: ubuntu-latest
484484
steps:
485485

486-
- uses: azure/login@v1
486+
- uses: azure/login@v2
487487
with:
488488
creds: ${{ secrets.AZURE_CREDENTIALS }}
489489
environment: 'AzureUSGovernment'
@@ -506,7 +506,7 @@ jobs:
506506
runs-on: ubuntu-latest
507507
steps:
508508

509-
- uses: azure/login@v1
509+
- uses: azure/login@v2
510510
with:
511511
creds: ${{ secrets.AZURE_CREDENTIALS }}
512512
environment: 'AzureStack'
@@ -534,7 +534,7 @@ jobs:
534534
steps:
535535

536536
- name: Azure Login
537-
uses: azure/login@v1
537+
uses: azure/login@v2
538538
with:
539539
client-id: ${{ secrets.AZURE_CLIENT_ID }}
540540
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -556,30 +556,10 @@ jobs:
556556
Get-AzContext
557557
```
558558
559-
## Az logout and security hardening
560-
561-
This action doesn't implement ```az logout``` by default at the end of execution. However, there is no way to tamper with the credentials or account information because the GitHub-hosted runner is on a VM that will get re-imaged for every customer run, which deletes everything. But if the runner is self-hosted (not provided by GitHub), it is recommended to manually log out at the end of the workflow, as shown below. More details on security of the runners can be found [here](https://docs.github.com/actions/learn-github-actions/security-hardening-for-github-actions#hardening-for-self-hosted-runners).
559+
## Security hardening
562560
563561
> [!WARNING]
564-
> When using self hosted runners it is possible to have multiple runners on a single VM. Currently if your runners share a single user on the VM each runner will share the same credentials. That means in detail that each runner is able to change the permissions of another run. As a workaround we propose to use one single VM user per runner. If you start the runner as a service, do not forget to add the [optional user argument](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service#installing-the-service)
565-
566-
```yaml
567-
- name: Azure CLI script
568-
uses: azure/CLI@v1
569-
with:
570-
inlineScript: |
571-
az logout
572-
az cache purge
573-
az account clear
574-
575-
- name: Azure PowerShell script
576-
uses: azure/powershell@v1
577-
with:
578-
azPSVersion: "latest"
579-
inlineScript: |
580-
Clear-AzContext -Scope Process
581-
Clear-AzContext -Scope CurrentUser
582-
```
562+
> When using self hosted runners it is possible to have multiple runners on a single VM. Currently if your runners share a single user on the VM each runner will share the same credentials. That means in detail that each runner is able to change the permissions of another run. As a workaround we propose to use one single VM user per runner. If you start the runner as a service, do not forget to add the [optional user argument](https://docs.github.com/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service#installing-the-service)
583563
584564
## Azure CLI dependency
585565

0 commit comments

Comments
 (0)