Manage resource groups

Manage Azure subscriptions and governance

📘Microsoft Certified: Azure Administrator Associate (AZ-104)


1. What is a Resource Group?

A Resource Group (RG) in Azure is a logical container that holds related Azure resources. These resources can include virtual machines (VMs), storage accounts, virtual networks, databases, and more.

Key points:

  • All resources in a resource group share the same lifecycle. If you delete the resource group, all resources inside it are deleted too.
  • A resource can only belong to one resource group.
  • Resource groups help organize resources by project, environment (like dev/test/prod), or department.
  • Resource groups exist at the subscription level, so every resource group belongs to a subscription.

Example in IT context:
If your company runs an application, all the VMs, databases, storage accounts, and networking resources for that app can be put in one resource group. This way, you can manage them together.


2. Creating a Resource Group

You can create a resource group in multiple ways:

  1. Azure Portal
    • Go to Azure Portal → Resource Groups → Create.
    • Fill in:
      • Name – A unique name for the resource group.
      • Subscription – Choose which subscription it belongs to.
      • Region (Location) – The region where metadata about the resource group is stored (not necessarily where all resources are).
  2. Azure PowerShell New-AzResourceGroup -Name MyResourceGroup -Location "EastUS"
  3. Azure CLI az group create --name MyResourceGroup --location eastus

Important Exam Note:

  • The location of the resource group does not restrict resources in it. You can have resources in different regions in the same resource group. The location just stores metadata about the RG.

3. Managing Resources in a Resource Group

Once the RG is created, you can:

  • Add resources: Any resource you create can be placed inside an RG.
  • Move resources: You can move resources between resource groups or subscriptions, as long as the resource type supports it.
  • Delete resources: Deleting the resource group deletes all contained resources.

Example:
If you have a VM and a storage account in DevResourceGroup, deleting DevResourceGroup will delete both the VM and the storage account automatically.

Commands for management:

  • PowerShell – Move a resource: Move-AzResource -ResourceId "/subscriptions/xxxx/resourceGroups/OldRG/providers/Microsoft.Compute/virtualMachines/MyVM" -DestinationResourceGroupName "NewRG"
  • CLI – List resources in RG: az resource list --resource-group MyResourceGroup

4. Best Practices for Resource Groups

  1. Organize by lifecycle or project:
    Resources that share the same lifecycle (development, test, production) should be grouped together.
  2. Use naming conventions:
    Example: ProjectName-Environment-ResourceType
    • WebApp-Prod-RG
    • DB-Test-RG
  3. Keep permissions simple:
    Assign roles at the resource group level to control access to all resources in that group.
  4. Monitor costs:
    You can check costs by resource group, which helps IT teams track spending by project or department.

5. Moving and Deleting Resource Groups

  • Move resources:
    Some resources can be moved to another resource group within the same subscription or to another subscription.
    Exam note: Some resources cannot be moved (like some classic resources or resources with dependencies).
  • Delete a resource group:
    This deletes all resources inside.
    • In Portal: Resource Group → Delete Resource Group.
    • PowerShell: Remove-AzResourceGroup -Name MyResourceGroup
    • CLI: az group delete --name MyResourceGroup

Important Exam Note:

  • Deletion is permanent. Azure will ask for confirmation before deleting.

6. Resource Group Limits

  • A subscription can have up to 980 resource groups.
  • Each resource group can have up to 800 resources (soft limits may apply for some resource types).

7. Monitoring and Tagging

While managing RGs:

  • Tagging:
    Apply tags at the resource group level. Tags help categorize and manage resources (like Department=IT, Project=AppX).
  • Azure Policy:
    You can assign policies at the resource group level to enforce rules (like allowed VM sizes or locations).
  • Cost Management:
    Resource groups are used to track cost per project or department in Azure Cost Management.

8. Summary for Exam

ConceptKey Points
Resource GroupLogical container for Azure resources, same lifecycle.
CreationPortal, CLI, PowerShell. Location stores metadata.
ManagementAdd, move, delete resources. Access control via RBAC.
Best PracticesOrganize by project/lifecycle, use naming conventions, apply tags.
DeletionDeletes all contained resources. Confirm before deleting.
LimitsMax 980 RGs per subscription, 800 resources per RG.
MonitoringUse tags, policies, cost management, alerts.

Exam Tips:

  • Know how to create, manage, move, and delete RGs.
  • Understand the lifecycle of resources inside an RG.
  • Know limits, tagging, and cost management use cases.
  • Remember: resource group location is metadata only, resources can be in different regions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Buy Me a Coffee