public static GetResourceId ( System.Guid subscriptionId, string resourceGroupName, string parentResource, string resourceType, string resourceName ) : string | ||
subscriptionId | System.Guid | The subscription. |
resourceGroupName | string | The resource group |
parentResource | string | The parent resource in the format: '{resourceType}/{typeName}' |
resourceType | string | The resource type string in the format: '{providerName}/{typeName}' |
resourceName | string | The resource name in the format: '{resourceName}' |
Résultat | string |
/// <summary> /// Gets the id of the resource group from the resource id. /// </summary> /// <param name="resourceId">The resource id.</param> public static string GetResourceGroupId(string resourceId) { var subscriptionId = ResourceIdUtility.GetSubscriptionId(resourceId); if (string.IsNullOrWhiteSpace(subscriptionId)) { return(null); } Guid subscriptionGuid; if (!Guid.TryParse(subscriptionId, out subscriptionGuid)) { return(null); } var resourceGroupName = ResourceIdUtility.GetResourceGroupName(resourceId); if (string.IsNullOrWhiteSpace(resourceGroupName)) { return(null); } return(ResourceIdUtility.GetResourceId( subscriptionId: subscriptionGuid, resourceGroupName: resourceGroupName, resourceType: null, resourceName: null)); }