@@ -156,28 +156,28 @@ public async Task<AzureOperationResponse<string>> GeneratevpnclientpackageWithHt
156
156
var result = new AzureOperationResponse < string > ( ) ;
157
157
result . Request = httpRequest ;
158
158
result . Response = httpResponse ;
159
- if ( httpResponse . Headers . Contains ( "x-ms-request-id" ) )
159
+ string locationResultsUrl = string . Empty ;
160
+
161
+ // Retrieve the location from LocationUri
162
+ if ( httpResponse . Headers . Contains ( "Location" ) )
160
163
{
161
- result . RequestId = httpResponse . Headers . GetValues ( "x-ms-request-id " ) . FirstOrDefault ( ) ;
164
+ locationResultsUrl = httpResponse . Headers . GetValues ( "Location " ) . FirstOrDefault ( ) ;
162
165
}
163
166
else
164
167
{
165
- throw new Exception ( string . Format ( "Get-AzureRmVpnClientPackage Operation Failed as no valid status code received in response!" ) ) ;
168
+ throw new Exception ( string . Format ( "Get-AzureRmVpnClientPackage Operation Failed as no valid Location header received in response!" ) ) ;
166
169
}
167
170
168
- string operationId = result . RequestId ;
171
+ if ( string . IsNullOrEmpty ( locationResultsUrl ) )
172
+ {
173
+ throw new Exception ( string . Format ( "Get-AzureRmVpnClientPackage Operation Failed as no valid Location header value received in response!" ) ) ;
174
+ }
169
175
#endregion
170
176
171
177
#region 2. Wait for Async operation to succeed and then Get the content i.e. VPN Client package Url from locationResults
172
178
//Microsoft.WindowsAzure.Commands.Utilities.Common.TestMockSupport.Delay(60000);
173
179
174
180
// 2. Wait for Async operation to succeed
175
- var locationResultsUrl = new Uri ( new Uri ( baseUrl + ( baseUrl . EndsWith ( "/" ) ? "" : "/" ) ) , "subscriptions/{subscriptionId}/providers/Microsoft.Network/" +
176
- "locations/westus.validation/operationResults/{operationId}" ) . ToString ( ) ;
177
- locationResultsUrl = locationResultsUrl . Replace ( "{operationId}" , Uri . EscapeDataString ( operationId ) ) ;
178
- locationResultsUrl = locationResultsUrl . Replace ( "{subscriptionId}" , Uri . EscapeDataString ( NetworkManagementClient . SubscriptionId ) ) ;
179
- locationResultsUrl += "?" + string . Join ( "&" , string . Format ( "api-version={0}" , Uri . EscapeDataString ( apiVersion ) ) ) ;
180
-
181
181
DateTime startTime = DateTime . UtcNow ;
182
182
DateTime giveUpAt = DateTime . UtcNow . AddMinutes ( 3 ) ;
183
183
0 commit comments