@@ -52,13 +52,16 @@ public static class CmdletHelpers
52
52
private static readonly Regex KeyVaultResourceIdRegex =
53
53
new Regex ( @"^\/subscriptions\/(?<subscriptionName>[^\/]+)\/resourceGroups\/(?<resourceGroupName>[^\/]+)\/providers\/Microsoft.KeyVault\/vaults\/(?<vaultName>[^\/]+)$" , RegexOptions . IgnoreCase ) ;
54
54
55
+ private static readonly Regex AppServiceEnvironmentResourceIdRegex =
56
+ new Regex ( @"^\/subscriptions\/(?<subscriptionName>[^\/]+)\/resourceGroups\/(?<resourceGroupName>[^\/]+)\/providers\/Microsoft.Web\/hostingEnvironments\/(?<aseName>[^\/]+)$" , RegexOptions . IgnoreCase ) ;
57
+
55
58
private static readonly Dictionary < string , int > WorkerSizes = new Dictionary < string , int > ( StringComparer . OrdinalIgnoreCase ) { { "Small" , 1 } , { "Medium" , 2 } , { "Large" , 3 } , { "ExtraLarge" , 4 } } ;
56
59
57
60
private const string ProductionSlotName = "Production" ;
58
61
59
62
private const string FmtSiteWithSlotName = "{0}({1})" ;
60
- public const string ApplicationServiceEnvironmentResourcesName = "hostingEnvironments" ;
61
- private const string ApplicationServiceEnvironmentResourceIdFormat =
63
+ public const string AppServiceEnvironmentResourcesName = "hostingEnvironments" ;
64
+ private const string AppServiceEnvironmentResourceIdFormat =
62
65
"/subscriptions/{0}/resourcegroups/{1}/providers/Microsoft.Web/{2}/{3}" ;
63
66
64
67
public const string DockerRegistryServerUrl = "DOCKER_REGISTRY_SERVER_URL" ;
@@ -180,10 +183,10 @@ internal static bool ShouldUseDeploymentSlot(string webSiteName, string slotName
180
183
internal static HostingEnvironmentProfile CreateHostingEnvironmentProfile ( string subscriptionId , string resourceGroupName , string aseResourceGroupName , string aseName )
181
184
{
182
185
var rg = string . IsNullOrEmpty ( aseResourceGroupName ) ? resourceGroupName : aseResourceGroupName ;
183
- var aseResourceId = CmdletHelpers . GetApplicationServiceEnvironmentResourceId ( subscriptionId , rg , aseName ) ;
186
+ var aseResourceId = CmdletHelpers . GetAppServiceEnvironmentResourceId ( subscriptionId , rg , aseName ) ;
184
187
return new HostingEnvironmentProfile (
185
188
aseResourceId ,
186
- CmdletHelpers . ApplicationServiceEnvironmentResourcesName ,
189
+ CmdletHelpers . AppServiceEnvironmentResourcesName ,
187
190
aseName ) ;
188
191
}
189
192
@@ -269,6 +272,24 @@ internal static bool TryParseAppServicePlanMetadataFromResourceId(string resourc
269
272
return false ;
270
273
}
271
274
275
+ internal static bool TryParseAppServiceEnvironmentMetadataFromResourceId ( string resourceId , out string resourceGroupName ,
276
+ out string aseName )
277
+ {
278
+ var match = AppServiceEnvironmentResourceIdRegex . Match ( resourceId ) ;
279
+ if ( match . Success )
280
+ {
281
+ resourceGroupName = match . Groups [ "resourceGroupName" ] . Value ;
282
+ aseName = match . Groups [ "aseName" ] . Value ;
283
+
284
+ return true ;
285
+ }
286
+
287
+ resourceGroupName = null ;
288
+ aseName = null ;
289
+
290
+ return false ;
291
+ }
292
+
272
293
internal static bool IsValidAKVResourceId ( string resourceId )
273
294
{
274
295
return KeyVaultResourceIdRegex . Match ( resourceId ) . Success ;
@@ -345,10 +366,10 @@ public static string GenerateSiteWithSlotName(string siteName, string slotName)
345
366
return siteName ;
346
367
}
347
368
348
- internal static string GetApplicationServiceEnvironmentResourceId ( string subscriptionId , string resourceGroupName , string applicationServiceEnvironmentName )
369
+ internal static string GetAppServiceEnvironmentResourceId ( string subscriptionId , string resourceGroupName , string appServiceEnvironmentName )
349
370
{
350
- return string . Format ( ApplicationServiceEnvironmentResourceIdFormat , subscriptionId , resourceGroupName , ApplicationServiceEnvironmentResourcesName ,
351
- applicationServiceEnvironmentName ) ;
371
+ return string . Format ( AppServiceEnvironmentResourceIdFormat , subscriptionId , resourceGroupName , AppServiceEnvironmentResourcesName ,
372
+ appServiceEnvironmentName ) ;
352
373
}
353
374
354
375
internal static HostNameSslState [ ] GetHostNameSslStatesFromSiteResponse ( Site site , string hostName = null )
0 commit comments