@@ -121,21 +121,20 @@ public override void ExecuteCmdlet()
121
121
122
122
if ( ShouldProcess ( this . StorageAccountName , "Restore Blob Range" ) )
123
123
{
124
+ Track2 . StorageAccountResource account = this . StorageClientTrack2 . GetStorageAccount ( this . ResourceGroupName , this . StorageAccountName ) ;
125
+ var restoreLro = account . RestoreBlobRanges (
126
+ WaitUntil . Started ,
127
+ new Track2Models . BlobRestoreContent (
128
+ this . TimeToRestore . ToUniversalTime ( ) ,
129
+ PSBlobRestoreRange . ParseBlobRestoreRanges ( this . BlobRestoreRange ) ) ) ;
130
+
131
+ // This is a temporary workaround of SDK issue https://github.com/Azure/azure-sdk-for-net/issues/29060
132
+ // The workaround is to get the raw response and parse it into the output desired
133
+ // The Blob restore status should be got from SDK directly once the issue is fixed
134
+ Dictionary < string , object > temp = restoreLro . GetRawResponse ( ) . Content . ToObjectFromJson ( ) as Dictionary < string , object > ;
135
+
124
136
if ( waitForComplete )
125
137
{
126
- Track2 . StorageAccountResource account = this . StorageClientTrack2 . GetStorageAccount ( this . ResourceGroupName , this . StorageAccountName ) ;
127
- var restoreLro = account . RestoreBlobRanges (
128
- WaitUntil . Started ,
129
- new Track2Models . BlobRestoreContent (
130
- this . TimeToRestore ,
131
- PSBlobRestoreRange . ParseBlobRestoreRanges ( this . BlobRestoreRange ) )
132
- ) ;
133
-
134
- // This is a temporary workaround of SDK issue https://github.com/Azure/azure-sdk-for-net/issues/29060
135
- // The workaround is to get the raw response and parse it into the output desired
136
- // The Blob restore status should be got from SDK directly once the issue is fixed
137
- Dictionary < string , object > temp = restoreLro . GetRawResponse ( ) . Content . ToObjectFromJson ( ) as Dictionary < string , object > ;
138
-
139
138
if ( temp == null )
140
139
{
141
140
throw new InvalidJobStateException ( "Could not fetch the Blob restore response." ) ;
@@ -162,14 +161,6 @@ public override void ExecuteCmdlet()
162
161
}
163
162
else
164
163
{
165
- Track2 . StorageAccountResource account = this . StorageClientTrack2 . GetStorageAccount ( this . ResourceGroupName , this . StorageAccountName ) ;
166
- var restoreLro = account . RestoreBlobRanges (
167
- WaitUntil . Started ,
168
- new Track2Models . BlobRestoreContent (
169
- this . TimeToRestore . ToUniversalTime ( ) ,
170
- PSBlobRestoreRange . ParseBlobRestoreRanges ( this . BlobRestoreRange ) ) ) ;
171
- Dictionary < string , object > temp = restoreLro . GetRawResponse ( ) . Content . ToObjectFromJson ( ) as Dictionary < string , object > ;
172
-
173
164
if ( temp == null )
174
165
{
175
166
throw new InvalidJobStateException ( "Could not fetch the Blob restore response." ) ;
0 commit comments