Skip to content

Commit

Permalink
[release/4.x] Cherry-pick: SNP CI: Login to az cli with VM's user-man…
Browse files Browse the repository at this point in the history
…aged identity (#6123) (#6216)
  • Loading branch information
eddyashton authored May 30, 2024
1 parent 72dfb3b commit 5d165db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 1 addition & 5 deletions .azure-pipelines-templates/azure_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ steps:
- script: |
set -ex
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# After the extension being in public preview, we can install the latest version automatically
# by `az extension update --name confcom`.
# But for now we need to manually manage the version.
az extension add --name confcom -y
az login --service-principal -u ${{ parameters.app_id }} -p ${{ parameters.service_principal_password }} --tenant ${{ parameters.tenant }}
az login --identity -u "${{ parameters.managed_identity_id }}"
name: setup_azure_cli
displayName: "Install Azure CLI and login"
12 changes: 5 additions & 7 deletions .azure-pipelines-templates/deploy_aci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ jobs:

- template: azure_cli.yml
parameters:
app_id: $(CCF_SNP_CI_APP_ID)
service_principal_password: $(CCF_SNP_CI_SERVICE_PRINCIPAL_PASSWORD)
tenant: $(CCF_SNP_CI_TENANT)
managed_identity_id: $(CCF_SNP_CI_MANAGED_IDENTITY_ID)

- script: |
set -ex
Expand Down Expand Up @@ -89,13 +87,15 @@ jobs:
- job: cleanup_aci
displayName: "Cleanup ACI"
pool:
vmImage: ubuntu-20.04
name: ado-virtual-ccf-sub # For access to managed identity
dependsOn:
- generate_ssh_key
- deploy_primary_aci
- ${{ parameters.used_by }}
condition: always()
variables:
Codeql.SkipTaskAutoInjection: true
skipComponentGovernanceDetection: true
IpAddresses: $[ dependencies.deploy_primary_aci.outputs['deploy_primary_aci.ipAddresses'] ]
sshKey: $[ dependencies.generate_ssh_key.outputs['generate_ssh_key.sshKey'] ]
steps:
Expand All @@ -117,9 +117,7 @@ jobs:
- template: azure_cli.yml
parameters:
app_id: $(CCF_SNP_CI_APP_ID)
service_principal_password: $(CCF_SNP_CI_SERVICE_PRINCIPAL_PASSWORD)
tenant: $(CCF_SNP_CI_TENANT)
managed_identity_id: $(CCF_SNP_CI_MANAGED_IDENTITY_ID)

- script: |
set -ex
Expand Down

0 comments on commit 5d165db

Please sign in to comment.