Files
runner-images/images.CI/linux-and-win/cleanup.ps1
T

20 lines
791 B
PowerShell
Raw Normal View History

2020-02-14 19:09:09 +03:00
param(
2023-10-18 19:11:46 +02:00
[Parameter (Mandatory=$true)] [string] $TempResourceGroupName,
[Parameter (Mandatory=$true)] [string] $SubscriptionId,
[Parameter (Mandatory=$true)] [string] $ClientId,
[Parameter (Mandatory=$true)] [string] $ClientSecret,
[Parameter (Mandatory=$true)] [string] $TenantId
2020-02-14 19:09:09 +03:00
)
az login --service-principal --username $ClientId --password=$ClientSecret --tenant $TenantId | Out-Null
2023-10-18 19:11:46 +02:00
az account set --subscription $SubscriptionId | Out-Null
2020-02-14 19:09:09 +03:00
2023-10-18 19:11:46 +02:00
$groupExist = az group exists --name $TempResourceGroupName
2020-02-14 19:09:09 +03:00
if ($groupExist -eq "true") {
Write-Host "Found a match, deleting temporary files"
2023-10-18 19:11:46 +02:00
az group delete --name $TempResourceGroupName --yes | Out-Null
2022-06-16 11:32:30 +02:00
Write-Host "Temporary group was deleted successfully"
2020-02-14 19:09:09 +03:00
} else {
Write-Host "No temporary groups found"
2023-10-18 19:11:46 +02:00
}