Skip to content

Commit

Permalink
Updated commands to properly remove Service Principal permissions and…
Browse files Browse the repository at this point in the history
… remove the SPN
  • Loading branch information
Matthew Garrett committed Aug 24, 2023
1 parent 1add0d3 commit f554626
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/azure-ipam-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,16 @@ jobs:
shell: pwsh
run: |
$tenantId = (Get-AzContext).Tenant.Id
$scope = "/providers/Microsoft.Management/managementGroups/$TenantId"
$scope = "/providers/Microsoft.Management/managementGroups/$tenantId"
$uiApp = Get-AzADApplication -ApplicationId ${{ needs.deploy.outputs.ipamUIAppId }}
$engineApp = Get-AzADApplication -ApplicationId ${{ needs.deploy.outputs.ipamEngineAppId }}
Write-Host "-------------------------------"
Write-Host "Scope: $scope"
$engineApp | ConvertTo-Json
Write-Host "-------------------------------"
$engineSpn = Get-AzADServicePrincipal -ApplicationId ${{ needs.deploy.outputs.ipamEngineAppId }}
Remove-AzResourceGroup -Name ${{ needs.deploy.outputs.ipamResourceGroup }} -Force
Remove-AzRoleAssignment -ObjectId $engineApp.Id -Scope $scope -RoleDefinitionName Reader
Remove-AzRoleAssignment -ObjectId $engineSpn.Id -Scope $scope -RoleDefinitionName Reader
$engineSpn | Remove-AzADServicePrincipal
$uiApp | Remove-AzADApplication
$engineApp | Remove-AzADApplication
Expand Down

0 comments on commit f554626

Please sign in to comment.