Skip to content

Commit 5d165db

Browse files
authored
[release/4.x] Cherry-pick: SNP CI: Login to az cli with VM's user-managed identity (#6123) (#6216)
1 parent 72dfb3b commit 5d165db

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

.azure-pipelines-templates/azure_cli.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ steps:
22
- script: |
33
set -ex
44
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
5-
# After the extension being in public preview, we can install the latest version automatically
6-
# by `az extension update --name confcom`.
7-
# But for now we need to manually manage the version.
8-
az extension add --name confcom -y
9-
az login --service-principal -u ${{ parameters.app_id }} -p ${{ parameters.service_principal_password }} --tenant ${{ parameters.tenant }}
5+
az login --identity -u "${{ parameters.managed_identity_id }}"
106
name: setup_azure_cli
117
displayName: "Install Azure CLI and login"

.azure-pipelines-templates/deploy_aci.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ jobs:
4343

4444
- template: azure_cli.yml
4545
parameters:
46-
app_id: $(CCF_SNP_CI_APP_ID)
47-
service_principal_password: $(CCF_SNP_CI_SERVICE_PRINCIPAL_PASSWORD)
48-
tenant: $(CCF_SNP_CI_TENANT)
46+
managed_identity_id: $(CCF_SNP_CI_MANAGED_IDENTITY_ID)
4947

5048
- script: |
5149
set -ex
@@ -89,13 +87,15 @@ jobs:
8987
- job: cleanup_aci
9088
displayName: "Cleanup ACI"
9189
pool:
92-
vmImage: ubuntu-20.04
90+
name: ado-virtual-ccf-sub # For access to managed identity
9391
dependsOn:
9492
- generate_ssh_key
9593
- deploy_primary_aci
9694
- ${{ parameters.used_by }}
9795
condition: always()
9896
variables:
97+
Codeql.SkipTaskAutoInjection: true
98+
skipComponentGovernanceDetection: true
9999
IpAddresses: $[ dependencies.deploy_primary_aci.outputs['deploy_primary_aci.ipAddresses'] ]
100100
sshKey: $[ dependencies.generate_ssh_key.outputs['generate_ssh_key.sshKey'] ]
101101
steps:
@@ -117,9 +117,7 @@ jobs:
117117
118118
- template: azure_cli.yml
119119
parameters:
120-
app_id: $(CCF_SNP_CI_APP_ID)
121-
service_principal_password: $(CCF_SNP_CI_SERVICE_PRINCIPAL_PASSWORD)
122-
tenant: $(CCF_SNP_CI_TENANT)
120+
managed_identity_id: $(CCF_SNP_CI_MANAGED_IDENTITY_ID)
123121

124122
- script: |
125123
set -ex

0 commit comments

Comments
 (0)