Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

🌐 Azure Resource Group Management – CLI & PowerShell

This guide demonstrates how to create, list, and delete Azure Resource Groups using Azure CLI and Azure PowerShell, with annotated command examples.

📦 Prerequisites

  • Azure CLI or Azure PowerShell installed.
  • Logged in to Azure via az login or Connect-AzAccount.

⚙️ Azure CLI Commands

➕ Create a Resource Group

# Create a new resource group named "test-resource-group" in the "northeurope" region
az group create -l northeurope -n test-resource-group
📄 Example Output
{
  "id": "/subscriptions/<sub-id>/resourceGroups/test-resource-group",
  "location": "northeurope",
  "name": "test-resource-group",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "type": "Microsoft.Resources/resourceGroups"
}

📃 List All Resource Groups

# List all resource groups in your subscription
az group list
📄 Example Output (JSON)
[
  {
    "name": "DEMO-RG",
    "location": "northeurope",
    "properties": {
      "provisioningState": "Succeeded"
    }
  },
  ...
]

📊 Display Resource Groups in Table Format

# Query and display only name and location in table format
az group list --query "[].{Name:name, Location:location}" --output table

🖥️ Output:

Name                 Location
-------------------  ------------
DEMO-RG              northeurope
test-resource-group  northeurope
NetworkWatcherRG     koreacentral

❌ Delete a Resource Group

# Delete the specified resource group
az group delete -n test-resource-group

📌 Note: Prompts for confirmation — type y to proceed.


⚙️ Azure PowerShell Commands

➕ Create a Resource Group

# Create a new resource group in northeurope
New-AzResourceGroup -Name test-resource-group -Location northeurope
📄 Example Output
ResourceGroupName : test-resource-group
Location          : northeurope
ProvisioningState : Succeeded
ResourceId        : /subscriptions/<sub-id>/resourceGroups/test-resource-group

❌ Delete a Resource Group

# Delete the specified resource group
Remove-AzResourceGroup -Name test-resource-group

📌 Note: Prompts for confirmation — type Y to confirm.


📚 Reference

📖 Azure CLI: Manage resource groups

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors