@@ -633,6 +633,15 @@ begin {
633
633
$PSBoundParameters [' OutBuffer' ] = 1
634
634
}
635
635
$parameterSet = $PSCmdlet.ParameterSetName
636
+
637
+ $testPlayback = $false
638
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
639
+
640
+ $context = Get-AzContext
641
+ if (-not $context -and -not $testPlayback ) {
642
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
643
+ exit
644
+ }
636
645
637
646
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
638
647
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -658,8 +667,6 @@ begin {
658
667
List = ' Az.Storage.private\Get-AzStorageTaskAssignmentInstancesReport_List' ;
659
668
}
660
669
if ((' Get' , ' List' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
661
- $testPlayback = $false
662
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
663
670
if ($testPlayback ) {
664
671
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
665
672
} else {
@@ -889,6 +896,15 @@ begin {
889
896
$PSBoundParameters [' OutBuffer' ] = 1
890
897
}
891
898
$parameterSet = $PSCmdlet.ParameterSetName
899
+
900
+ $testPlayback = $false
901
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
902
+
903
+ $context = Get-AzContext
904
+ if (-not $context -and -not $testPlayback ) {
905
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
906
+ exit
907
+ }
892
908
893
909
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
894
910
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -914,8 +930,6 @@ begin {
914
930
List = ' Az.Storage.private\Get-AzStorageTaskAssignment_List' ;
915
931
}
916
932
if ((' Get' , ' List' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
917
- $testPlayback = $false
918
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
919
933
if ($testPlayback ) {
920
934
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
921
935
} else {
@@ -1181,6 +1195,15 @@ begin {
1181
1195
$PSBoundParameters [' OutBuffer' ] = 1
1182
1196
}
1183
1197
$parameterSet = $PSCmdlet.ParameterSetName
1198
+
1199
+ $testPlayback = $false
1200
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
1201
+
1202
+ $context = Get-AzContext
1203
+ if (-not $context -and -not $testPlayback ) {
1204
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
1205
+ exit
1206
+ }
1184
1207
1185
1208
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
1186
1209
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -1203,8 +1226,6 @@ begin {
1203
1226
CreateExpanded = ' Az.Storage.private\New-AzStorageTaskAssignment_CreateExpanded' ;
1204
1227
}
1205
1228
if ((' CreateExpanded' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
1206
- $testPlayback = $false
1207
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
1208
1229
if ($testPlayback ) {
1209
1230
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
1210
1231
} else {
@@ -1441,6 +1462,15 @@ begin {
1441
1462
$PSBoundParameters [' OutBuffer' ] = 1
1442
1463
}
1443
1464
$parameterSet = $PSCmdlet.ParameterSetName
1465
+
1466
+ $testPlayback = $false
1467
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
1468
+
1469
+ $context = Get-AzContext
1470
+ if (-not $context -and -not $testPlayback ) {
1471
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
1472
+ exit
1473
+ }
1444
1474
1445
1475
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
1446
1476
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -1465,8 +1495,6 @@ begin {
1465
1495
DeleteViaIdentityStorageAccount = ' Az.Storage.private\Remove-AzStorageTaskAssignment_DeleteViaIdentityStorageAccount' ;
1466
1496
}
1467
1497
if ((' Delete' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
1468
- $testPlayback = $false
1469
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
1470
1498
if ($testPlayback ) {
1471
1499
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
1472
1500
} else {
@@ -1775,6 +1803,15 @@ begin {
1775
1803
$PSBoundParameters [' OutBuffer' ] = 1
1776
1804
}
1777
1805
$parameterSet = $PSCmdlet.ParameterSetName
1806
+
1807
+ $testPlayback = $false
1808
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
1809
+
1810
+ $context = Get-AzContext
1811
+ if (-not $context -and -not $testPlayback ) {
1812
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
1813
+ exit
1814
+ }
1778
1815
1779
1816
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
1780
1817
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -1799,8 +1836,6 @@ begin {
1799
1836
UpdateViaIdentityStorageAccountExpanded = ' Az.Storage.private\Update-AzStorageTaskAssignment_UpdateViaIdentityStorageAccountExpanded' ;
1800
1837
}
1801
1838
if ((' UpdateExpanded' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
1802
- $testPlayback = $false
1803
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
1804
1839
if ($testPlayback ) {
1805
1840
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
1806
1841
} else {
0 commit comments