Class ResourceGroupResource
- Namespace
 - Azure.ResourceManager.Resources
 
- Assembly
 - Azure.ResourceManager.dll
 
A Class representing a ResourceGroupResource along with the instance operations that can be performed on it.
public class ResourceGroupResource : ArmResource, IJsonModel<ResourceGroupData>, IPersistableModel<ResourceGroupData>
  - Inheritance
 - 
      
      
      ResourceGroupResource
 
- Implements
 - 
      IJsonModel<ResourceGroupData>IPersistableModel<ResourceGroupData>
 
- Inherited Members
 
Constructors
ResourceGroupResource()
Initializes a new instance of the ResourceGroupResource class for mocking.
protected ResourceGroupResource()
  Fields
ResourceType
Gets the resource type for the operations.
public static readonly ResourceType ResourceType
  Field Value
- ResourceType
 
Properties
Data
Gets the data representing this Feature.
public virtual ResourceGroupData Data { get; }
  Property Value
Exceptions
- InvalidOperationException
 Throws if there is no data loaded in the current instance.
HasData
Gets whether or not the current instance has data.
public virtual bool HasData { get; }
  Property Value
Methods
AddTag(string, string, CancellationToken)
Add a tag to the current resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Response<ResourceGroupResource> AddTag(string key, string value, CancellationToken cancellationToken = default)
  Parameters
keystringThe key for the tag.
valuestringThe value for the tag.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
 
Exceptions
- ArgumentNullException
 keyorvalueis null.
AddTagAsync(string, string, CancellationToken)
Add a tag to the current resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<Response<ResourceGroupResource>> AddTagAsync(string key, string value, CancellationToken cancellationToken = default)
  Parameters
keystringThe key for the tag.
valuestringThe value for the tag.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
 
Exceptions
- ArgumentNullException
 keyorvalueis null.
CreateResourceIdentifier(string, string)
Generate the resource identifier of a ResourceGroupResource instance.
public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName)
  Parameters
Returns
- ResourceIdentifier
 
Delete(WaitUntil, string, CancellationToken)
When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Delete
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual ArmOperation Delete(WaitUntil waitUntil, string forceDeletionTypes = null, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
forceDeletionTypesstringThe resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
DeleteAsync(WaitUntil, string, CancellationToken)
When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Delete
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<ArmOperation> DeleteAsync(WaitUntil waitUntil, string forceDeletionTypes = null, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
forceDeletionTypesstringThe resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
ExportTemplate(WaitUntil, ExportTemplate, CancellationToken)
Captures the specified resource group as a template.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate
 - Operation IdResourceGroups_ExportTemplate
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual ArmOperation<ResourceGroupExportResult> ExportTemplate(WaitUntil waitUntil, ExportTemplate exportTemplate, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
exportTemplateExportTemplateParameters for exporting the template.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
 exportTemplateis null.
ExportTemplateAsync(WaitUntil, ExportTemplate, CancellationToken)
Captures the specified resource group as a template.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate
 - Operation IdResourceGroups_ExportTemplate
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<ArmOperation<ResourceGroupExportResult>> ExportTemplateAsync(WaitUntil waitUntil, ExportTemplate exportTemplate, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
exportTemplateExportTemplateParameters for exporting the template.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
 exportTemplateis null.
Get(CancellationToken)
Gets a resource group.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Response<ResourceGroupResource> Get(CancellationToken cancellationToken = default)
  Parameters
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
 
GetAsync(CancellationToken)
Gets a resource group.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<Response<ResourceGroupResource>> GetAsync(CancellationToken cancellationToken = default)
  Parameters
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
 
GetGenericResources(string, string, int?, CancellationToken)
Get all the resources for a resource group.
public virtual Pageable<GenericResource> GetGenericResources(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default)
  Parameters
filterstringThe filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId.
expandstringComma-separated list of additional properties to be included in the response. Valid values include
createdTime,changedTimeandprovisioningState. For example,$expand=createdTime,changedTime.topint?The number of results to return. If null is passed, returns all resources.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Pageable<GenericResource>
 A collection of GenericResource that may take multiple service requests to iterate over.
GetGenericResourcesAsync(string, string, int?, CancellationToken)
Get all the resources for a resource group.
public virtual AsyncPageable<GenericResource> GetGenericResourcesAsync(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default)
  Parameters
filterstringThe filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId.
expandstringComma-separated list of additional properties to be included in the response. Valid values include
createdTime,changedTimeandprovisioningState. For example,$expand=createdTime,changedTime.topint?The number of results to return. If null is passed, returns all resources.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- AsyncPageable<GenericResource>
 An async collection of GenericResource that may take multiple service requests to iterate over.
MoveResources(WaitUntil, ResourcesMoveContent, CancellationToken)
The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources
 - Operation IdResources_MoveResources
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual ArmOperation MoveResources(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
contentResourcesMoveContentParameters for moving resources.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
 contentis null.
MoveResourcesAsync(WaitUntil, ResourcesMoveContent, CancellationToken)
The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources
 - Operation IdResources_MoveResources
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<ArmOperation> MoveResourcesAsync(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
contentResourcesMoveContentParameters for moving resources.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
 contentis null.
RemoveTag(string, CancellationToken)
Removes a tag by key from the resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Response<ResourceGroupResource> RemoveTag(string key, CancellationToken cancellationToken = default)
  Parameters
keystringThe key for the tag.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
 
Exceptions
- ArgumentNullException
 keyis null.
RemoveTagAsync(string, CancellationToken)
Removes a tag by key from the resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<Response<ResourceGroupResource>> RemoveTagAsync(string key, CancellationToken cancellationToken = default)
  Parameters
keystringThe key for the tag.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
 
Exceptions
- ArgumentNullException
 keyis null.
SetTags(IDictionary<string, string>, CancellationToken)
Replace the tags on the resource with the given set.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Response<ResourceGroupResource> SetTags(IDictionary<string, string> tags, CancellationToken cancellationToken = default)
  Parameters
tagsIDictionary<string, string>The set of tags to use as replacement.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
 
Exceptions
- ArgumentNullException
 tagsis null.
SetTagsAsync(IDictionary<string, string>, CancellationToken)
Replace the tags on the resource with the given set.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Get
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<Response<ResourceGroupResource>> SetTagsAsync(IDictionary<string, string> tags, CancellationToken cancellationToken = default)
  Parameters
tagsIDictionary<string, string>The set of tags to use as replacement.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
 
Exceptions
- ArgumentNullException
 tagsis null.
Update(ResourceGroupPatch, CancellationToken)
Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Update
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Response<ResourceGroupResource> Update(ResourceGroupPatch patch, CancellationToken cancellationToken = default)
  Parameters
patchResourceGroupPatchParameters supplied to update a resource group.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
 
Exceptions
- ArgumentNullException
 patchis null.
UpdateAsync(ResourceGroupPatch, CancellationToken)
Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
 - Operation IdResourceGroups_Update
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<Response<ResourceGroupResource>> UpdateAsync(ResourceGroupPatch patch, CancellationToken cancellationToken = default)
  Parameters
patchResourceGroupPatchParameters supplied to update a resource group.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
 
Exceptions
- ArgumentNullException
 patchis null.
ValidateMoveResources(WaitUntil, ResourcesMoveContent, CancellationToken)
This operation checks whether the specified resources can be moved to the target. The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources
 - Operation IdResources_ValidateMoveResources
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual ArmOperation ValidateMoveResources(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
contentResourcesMoveContentParameters for moving resources.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
 contentis null.
ValidateMoveResourcesAsync(WaitUntil, ResourcesMoveContent, CancellationToken)
This operation checks whether the specified resources can be moved to the target. The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources
 - Operation IdResources_ValidateMoveResources
 - Default Api Version2022-09-01
 - ResourceResourceGroupResource
 
public virtual Task<ArmOperation> ValidateMoveResourcesAsync(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
  Parameters
waitUntilWaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
contentResourcesMoveContentParameters for moving resources.
cancellationTokenCancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
 contentis null.