Skip to content

Commit d7246eb

Browse files
committed
null check
1 parent 68da1e9 commit d7246eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ALZ/Public/Remove-PlatformLandingZone.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ function Remove-PlatformLandingZone {
10771077
-IsPlan -LogFilePath $using:TempLogFileForPlan
10781078
} else {
10791079
$result = (az account management-group subscription add --name $subscriptionsTargetManagementGroup --subscription $subscription.name 2>&1)
1080-
if($result.ToLower().Contains("Error")) {
1080+
if($result -and $result.ToLower().Contains("Error")) {
10811081
Write-ToConsoleLog "Failed to move subscription to target management group: $($subscriptionsTargetManagementGroup), subscription: $($subscription.displayName), $result" -IsWarning -NoNewLine
10821082
} else {
10831083
Write-ToConsoleLog "Moved subscription to target management group: $($subscriptionsTargetManagementGroup), subscription: $($subscription.displayName)" -NoNewLine
@@ -1092,7 +1092,7 @@ function Remove-PlatformLandingZone {
10921092
-IsPlan -LogFilePath $using:TempLogFileForPlan
10931093
} else {
10941094
$result = (az account management-group subscription remove --name $_ --subscription $subscription.name 2>&1)
1095-
if($result.ToLower().Contains("Error")) {
1095+
if($result -and $result.ToLower().Contains("Error")) {
10961096
Write-ToConsoleLog "Failed to remove subscription from management group: $_, subscription: $($subscription.displayName), $result" -IsWarning -NoNewLine
10971097
} else {
10981098
Write-ToConsoleLog "Removed subscription from management group: $_, subscription: $($subscription.displayName)" -NoNewLine

0 commit comments

Comments
 (0)