@@ -215,22 +215,27 @@ internal static string ResourceId(string? tenant, string? managementGroup, strin
215
215
return ResourceId ( tenant , managementGroup , subscriptionId , resourceGroup , typeParts , nameParts , scopeId , depth ) ;
216
216
}
217
217
218
- internal static string ResourceId ( string ? tenant , string ? managementGroup , string ? subscriptionId , string ? resourceGroup , string [ ] ? resourceType , string [ ] ? resourceName , string ? scopeId , int depth = int . MaxValue )
218
+ internal static string ResourceId ( string ? tenant , string ? managementGroup , string ? subscriptionId , string ? resourceGroup , string [ ] ? resourceTypeParts , string [ ] ? resourceNameParts , string ? scopeId , int depth = int . MaxValue )
219
219
{
220
- var resourceTypeLength = resourceType ? . Length ?? 0 ;
221
- var nameLength = resourceName ? . Length ?? 0 ;
220
+ var resourceTypeLength = resourceTypeParts ? . Length ?? 0 ;
221
+ var nameLength = resourceNameParts ? . Length ?? 0 ;
222
222
if ( resourceTypeLength != nameLength )
223
- throw new TemplateFunctionException ( nameof ( resourceType ) , FunctionErrorType . MismatchingResourceSegments , PSRuleResources . MismatchingResourceSegments ) ;
223
+ throw new TemplateFunctionException ( nameof ( resourceTypeParts ) , FunctionErrorType . MismatchingResourceSegments , PSRuleResources . MismatchingResourceSegments ) ;
224
224
225
225
if ( ! ResourceIdComponents ( scopeId , out var scopeTenant , out var scopeManagementGroup , out var scopeSubscriptionId , out var scopeResourceGroup , out var scopeResourceType , out var scopeResourceName ) )
226
226
{
227
227
scopeResourceType = null ;
228
228
scopeResourceName = null ;
229
229
}
230
230
231
- resourceType = MergeResourceNameOrType ( scopeResourceType , resourceType ) ;
232
- resourceName = MergeResourceNameOrType ( scopeResourceName , resourceName ) ;
233
- return ResourceId ( scopeTenant ?? tenant , scopeManagementGroup ?? managementGroup , scopeSubscriptionId ?? subscriptionId , scopeResourceGroup ?? resourceGroup , resourceType , resourceName , depth ) ;
231
+ resourceTypeParts = MergeResourceNameOrType ( scopeResourceType , resourceTypeParts ) ;
232
+ resourceNameParts = MergeResourceNameOrType ( scopeResourceName , resourceNameParts ) ;
233
+ return ResourceId ( scopeTenant ?? tenant , scopeManagementGroup ?? managementGroup , scopeSubscriptionId ?? subscriptionId , scopeResourceGroup ?? resourceGroup , resourceTypeParts , resourceNameParts , depth ) ;
234
+ }
235
+
236
+ internal static string ResourceGroupId ( string subscriptionId , string resourceGroup )
237
+ {
238
+ return string . Format ( "/subscriptions/{0}/resourceGroups/{1}" , subscriptionId , resourceGroup ) ;
234
239
}
235
240
236
241
private static string [ ] ? MergeResourceNameOrType ( string [ ] ? parentNameOrType , string [ ] ? nameOrType )
0 commit comments