Skip to content

Commit

Permalink
Skip missing blob container properties
Browse files Browse the repository at this point in the history
  • Loading branch information
benbp authored and azure-sdk committed Nov 6, 2024
1 parent de1c1ba commit 6a5feec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eng/common/scripts/Helpers/Resource-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ function RemoveStorageAccount($Account) {
}

foreach ($container in $containers) {
if (!($container | Get-Member 'BlobContainerProperties')) {
continue
}
if ($container.BlobContainerProperties.HasImmutableStorageWithVersioning) {
try {
# Use AzRm cmdlet as deletion will only work through ARM with the immutability policies defined on the blobs
Expand Down Expand Up @@ -395,7 +398,7 @@ function EnableBlobDeletion($Blob, $Container, $StorageAccountName, $ResourceGro
$Blob.ICloudBlob.BreakLease()
}

if ($container.BlobContainerProperties.HasImmutableStorageWithVersioning) {
if (($container | Get-Member 'BlobContainerProperties') -and $container.BlobContainerProperties.HasImmutableStorageWithVersioning) {
$forceBlobDeletion = $true
}

Expand Down

0 comments on commit 6a5feec

Please sign in to comment.