You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: utilities/pipelines/resourcePublish/Get-TemplateSpecsName.ps1
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -29,11 +29,15 @@ function Get-TemplateSpecsName {
29
29
# This is requried as certain modules generate names such as `MS.RecoveryServices.vaults.replicationFabrics.replicationProtectionContainers.replicationProtectionContainerMappings` which are longer than the allowed 90 characters for template specs
30
30
# Using the logic below, the name is shortened to `MS.RecoveryServices.vaults.replicationFabrics.replicationProtectionContainers.Mappings` which has 'only' 86 characters
31
31
$nameElems=$templateSpecIdentifier-split'\.'
32
-
for ($index=0; $index-lt$nameElems.Count; $index++) {
32
+
# Starting at index 2 to skip the resource provider
33
+
for ($index=2; $index-lt$nameElems.Count; $index++) {
33
34
if ($index-lt ($nameElems.count-1)) {
34
35
$stringToRemove=$nameElems[($index)]
35
36
$stringToCheck=$nameElems[($index+1)]
36
37
38
+
# If a name is replicated in a path, it is usually plural in the parent, and singular in the child path.
39
+
# For example: /virtualNetworks/ (plural) & /virtualNetworks/virtualNetworkPeerings/ (singular)
40
+
# In this case we want to remove the singular version from the subsequent string & format it accordingly
37
41
if ($stringToRemove.EndsWith('s') -and$stringToCheck.StartsWith($stringToRemove.Substring(0,$stringToRemove.length-1))) {
0 commit comments