@@ -264,7 +264,7 @@ private async Task<Dictionary<StorageKeyKind, string>> RetrieveStorageKeysAsync(
264
264
StringBuilder uriBuilder = new StringBuilder ( Context . Environment . GetEndpointAsUri ( AzureEnvironment . Endpoint . ResourceManager ) . ToString ( ) ) ;
265
265
uriBuilder . AppendFormat ( "{0}/listKeys?api-version={1}" ,
266
266
storageAccountId ,
267
- isClassicStorage ? "2016-11-01" : "2017-06-01" ) ;
267
+ isClassicStorage ? ClassicStorageListKeysApiVersion : NonClassicStorageListKeysApiVersion ) ;
268
268
269
269
// Define an exception to be thrown on failure.
270
270
//
@@ -281,8 +281,8 @@ private async Task<Dictionary<StorageKeyKind, string>> RetrieveStorageKeysAsync(
281
281
string secondaryKey = null ;
282
282
if ( isClassicStorage )
283
283
{
284
- primaryKey = ( string ) storageAccountKeysResponse [ "primaryKey" ] ;
285
- secondaryKey = ( string ) storageAccountKeysResponse [ "secondaryKey" ] ;
284
+ primaryKey = ( string ) storageAccountKeysResponse [ PrimaryKey ] ;
285
+ secondaryKey = ( string ) storageAccountKeysResponse [ SecondaryKey ] ;
286
286
}
287
287
else
288
288
{
@@ -367,5 +367,19 @@ private async Task<JToken> SendAsync(string url, HttpMethod method, Exception ex
367
367
368
368
return JToken . Parse ( await httpResponse . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ) ;
369
369
}
370
+
371
+ /// <summary>
372
+ /// Verson of classic storage listKeys REST-API.
373
+ /// </summary>
374
+ private const string ClassicStorageListKeysApiVersion = "2016-11-01" ;
375
+
376
+ /// <summary>
377
+ /// Verson of non classic storage listKeys REST-API.
378
+ /// </summary>
379
+ private const string NonClassicStorageListKeysApiVersion = "2017-06-01" ;
380
+
381
+ private const string PrimaryKey = "primaryKey" ;
382
+
383
+ private const string SecondaryKey = "secondaryKey" ;
370
384
}
371
385
}
0 commit comments