Skip to content

Commit

Permalink
Fixed issue with delete resource group (#3259)
Browse files Browse the repository at this point in the history
* Added a check to still pass if the resource group wasn't found. Typically this happens based on a timeout and then re-running it wouldn't find the RG.
  • Loading branch information
PTaladay authored and ShaunDonn2 committed Apr 27, 2023
1 parent 2bb5181 commit e00a320
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion build/jobs/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ jobs:
azureSubscription: $(ConnectedServiceName)
azurePowerShellVersion: latestVersion
ScriptType: InlineScript
Inline: 'Get-AzResourceGroup -Name $(ResourceGroupName) | Remove-AzResourceGroup -Verbose -Force'
Inline: |
Get-AzResourceGroup -Name $(ResourceGroupName) -ErrorVariable notPresent -ErrorAction SilentlyContinue
if ($notPresent) {
Write-Host "Resource group $(ResourceGroupName) not found"
} else {
Write-Host "Deleting resource group $(ResourceGroupName)"
Remove-AzResourceGroup -Name $(ResourceGroupName) -Force -Verbose
}
- template: ./cleanup-aad.yml

Expand Down

0 comments on commit e00a320

Please sign in to comment.