@@ -138,6 +138,15 @@ begin {
138
138
$PSBoundParameters [' OutBuffer' ] = 1
139
139
}
140
140
$parameterSet = $PSCmdlet.ParameterSetName
141
+
142
+ $testPlayback = $false
143
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
144
+
145
+ $context = Get-AzContext
146
+ if (-not $context -and -not $testPlayback ) {
147
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
148
+ exit
149
+ }
141
150
142
151
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
143
152
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -161,8 +170,6 @@ begin {
161
170
GetViaIdentity = ' Az.Storage.private\Get-AzStorageAccountMigration_GetViaIdentity' ;
162
171
}
163
172
if ((' Get' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
164
- $testPlayback = $false
165
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
166
173
if ($testPlayback ) {
167
174
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
168
175
} else {
@@ -355,6 +362,15 @@ begin {
355
362
$PSBoundParameters [' OutBuffer' ] = 1
356
363
}
357
364
$parameterSet = $PSCmdlet.ParameterSetName
365
+
366
+ $testPlayback = $false
367
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
368
+
369
+ $context = Get-AzContext
370
+ if (-not $context -and -not $testPlayback ) {
371
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
372
+ exit
373
+ }
358
374
359
375
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
360
376
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -379,8 +395,6 @@ begin {
379
395
List = ' Az.Storage.private\Get-AzStorageFileServiceUsage_List' ;
380
396
}
381
397
if ((' Get' , ' List' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
382
- $testPlayback = $false
383
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
384
398
if ($testPlayback ) {
385
399
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
386
400
} else {
@@ -552,6 +566,12 @@ param(
552
566
# SrpAccountMigrationType in ARM contract which is 'accountMigrations'
553
567
${Type} ,
554
568
569
+ [Parameter ()]
570
+ [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category (' Body' )]
571
+ [System.Management.Automation.SwitchParameter ]
572
+ # Forces the cmdlet to convert the account's redundancy configuration without prompting for confirmation.
573
+ ${Force} ,
574
+
555
575
[Parameter (ParameterSetName = ' CustomerViaJsonString' , Mandatory )]
556
576
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category (' Body' )]
557
577
[System.String ]
@@ -638,6 +658,15 @@ begin {
638
658
$PSBoundParameters [' OutBuffer' ] = 1
639
659
}
640
660
$parameterSet = $PSCmdlet.ParameterSetName
661
+
662
+ $testPlayback = $false
663
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
664
+
665
+ $context = Get-AzContext
666
+ if (-not $context -and -not $testPlayback ) {
667
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
668
+ exit
669
+ }
641
670
642
671
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
643
672
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -663,8 +692,6 @@ begin {
663
692
CustomerViaIdentityExpanded = ' Az.Storage.custom\Start-AzStorageAccountMigration' ;
664
693
}
665
694
if ((' CustomerExpanded' , ' CustomerViaJsonString' , ' CustomerViaJsonFilePath' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
666
- $testPlayback = $false
667
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
668
695
if ($testPlayback ) {
669
696
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
670
697
} else {
0 commit comments