Skip to content

Commit

Permalink
New service connection object with workloadidentity (#3855)
Browse files Browse the repository at this point in the history
* New serive connection object with cert is used

* new service connection with workload federated identity

* Azure Powershell version changed to 5

* Add support for ClientAssertion type
  • Loading branch information
rajithaalurims authored May 15, 2024
1 parent ab60c24 commit 36333f8
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/build-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ variables:
TestEnvironmentUrl_R5_Sql: 'https://$(DeploymentEnvironmentName)-r5-sql.azurewebsites.net'
#-----------------------------------------------------------------------------------------
TestClientUrl: 'https://$(DeploymentEnvironmentName)-client/'
ConnectedServiceName: 'Microsoft Health Open Source Subscription - new'
ConnectedServiceName: 'oss-service-connection-with-workloadidentity'
WindowsVmImage: 'windows-latest'
LinuxVmImage: 'ubuntu-latest'
TestApplicationResource: 'https://$(DeploymentEnvironmentName).$(tenantDomain)'
Expand Down
6 changes: 3 additions & 3 deletions build/ci-pipeline-mag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ stages:
jobs:
- job: ProvisionEnvironment
steps:
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: Provision Resource Group
inputs:
azureSubscription: $(ConnectedServiceName)
azurePowerShellVersion: latestVersion
ScriptType: inlineScript
Inline: |
New-AzResourceGroup -Name "$(resourceGroupRoot)" -Location "$(ResourceGroupRegion)" -Force
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Deploy Default Site'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down Expand Up @@ -67,7 +67,7 @@ stages:

# Deploy SQL Environment
New-AzResourceGroupDeployment -Name "$(DeploymentEnvironmentNameR4Sql)" -ResourceGroupName "$(resourceGroupRoot)" -TemplateFile $(System.DefaultWorkingDirectory)/samples/templates/default-azuredeploy.json -TemplateParameterObject $templateParameters -Verbose
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Delete resource group'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
2 changes: 1 addition & 1 deletion build/cleanup-pr-environments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ stages:
name: '$(SharedLinuxPool)'
vmImage: '$(LinuxVmImage)'
steps:
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Delete resource group'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
2 changes: 1 addition & 1 deletion build/jobs/clean-storage-accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
pool:
vmImage: $(WindowsVmImage)
steps:
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Clean Storage Accounts'
continueOnError: true
inputs:
Expand Down
2 changes: 1 addition & 1 deletion build/jobs/cleanup-aad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
azureSubscription: $(ConnectedServiceName)
KeyVaultName: 'resolute-oss-tenant-info'

- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Delete AAD apps'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
2 changes: 1 addition & 1 deletion build/jobs/cleanup-resourcegroup-aad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: '$(SharedLinuxPool)'
vmImage: '$(LinuxVmImage)'
steps:
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Delete resource group'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
2 changes: 1 addition & 1 deletion build/jobs/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: '$(SharedLinuxPool)'
vmImage: '$(LinuxVmImage)'
steps:
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Delete resource group'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
2 changes: 1 addition & 1 deletion build/jobs/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
parameters:
version: ${{parameters.version}}

- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Set Variables'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
4 changes: 2 additions & 2 deletions build/jobs/run-export-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
parameters:
version: ${{parameters.version}}

- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Set Variables'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
parameters:
version: ${{parameters.version}}

- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: 'Set Variables'
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
2 changes: 1 addition & 1 deletion build/pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ stages:
name: '$(DefaultLinuxPool)'
vmImage: '$(LinuxVmImage)'
steps:
- task: AzurePowerShell@4
- task: AzurePowerShell@5
displayName: Provision Resource Group
inputs:
azureSubscription: $(ConnectedServiceName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ function Add-AadTestAuthEnvironment {
Write-Host "Current context is service principal: $($azContext.Account.Id)"
$currentObjectId = (Get-AzADServicePrincipal -ServicePrincipalName $azContext.Account.Id).Id
}
elseif ($azContext.Account.Type -eq "ClientAssertion") {
Write-Host "Current context is ClientAssertion: $($azContext.Account.Id)"
$currentObjectId = (Get-AzADServicePrincipal -ServicePrincipalName $azContext.Account.Id).Id
}
else {
Write-Host "Current context is account of type '$($azContext.Account.Type)' with id of '$($azContext.Account.Id)"
throw "Running as an unsupported account type. Please use either a 'User' or 'Service Principal' to run this command"
Expand Down

0 comments on commit 36333f8

Please sign in to comment.