Skip to content

Commit

Permalink
Fix storage cleanup script (#4644)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankowitz authored Sep 25, 2024
1 parent bcb9c67 commit 76d9c46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/jobs/clean-storage-accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ jobs:
$storageAccounts = Get-AzStorageAccount -ResourceGroupName ${{ parameters.environmentName }}
foreach ($storageAccount in $storageAccounts) {
$storageContainers = Get-AzStorageContainer -Name * -Context $storageAccount.Context
# Create a storage context using Azure AD authentication
$ctx = New-AzStorageContext -StorageAccountName $storageAccount.StorageAccountName -UseConnectedAccount
$storageContainers = Get-AzStorageContainer -Name * -Context $ctx
foreach ($container in $storageContainers) {
$ageDiff = $currentUtcTime - $container.CloudBlobContainer.Properties.LastModified.UtcDateTime
if($ageDiff.TotalDays -ge 3) {
Expand Down

0 comments on commit 76d9c46

Please sign in to comment.