Skip to main content
Jorge Bernhardt Jorge Bernhardt
  1. Posts/

How to create a Resource Group in Microsoft Azure

·454 words·3 mins· 100 views · 5 likes ·
Azure CLI Azure PowerShell Get-AzureRmLocation Get-AzureRmSubscription

This post is the first in a series in which I will show how to create different resources in Microsoft Azure. Today I will show you how to create an essential component: a Resource Group.

An Azure resource group is a collection of Azure resources that are implemented as a unit and contains Azure resources such as a storage account, virtual networks, Virtual Machines, or a website.

This tutorial assumes that you already have a Microsoft Azure account set up.

Azure PowerShell Workaround>

Azure PowerShell Workaround #

If you want to know how to install the PowerShell Azure module on your machine, check out this link. The simplest way to get started is to sign in interactively at the command line.

Login-AzureRmAccount

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account. If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

Get-AzureRmSubscription
Select-AzureRmSubscription -Subscription "My Subscription"

Once you set your default subscription, you are ready to create the resource group with New-AzureRmResourceGroup cmdlet.

Resource Group
To create a Resource Group with PowerShell, use the New-AzureRmResourceGroup cmdlet with the following syntax:

New-AzureRmResourceGroup `
    -Name <String> `
    -Location <String>

New-AzureRmResourceGroup

-Location Parameter>

-Location Parameter #

With the following cmdlet in PowerShell, we obtain the list of existing locations in Azure.

Get-AzureRmLocation `
    | Select-Object DisplayName, Location

You can verify the task by running the Get-AzureRmResourceGroup cmdlet.

Get-AzureRmResourceGroup
Azure CLI Workaround>

Azure CLI Workaround #

You can use it in your browser with Azure Cloud Shell or install it on your machine. If you want to know how to install the Azure CLI, check out this link. The way to get started is to sign in interactively at the command line.

az login

This command will bring up a dialog box prompting you for your email address and password associated with your Azure account. If you have more than one subscription associated with your mail account, you can choose the default subscription. to perform this task, we will use the following commands:

az account list

az account set --subscription "Subscription Name"

To create a Resource Group with Azure CLI, use the following syntax:

az group create \
--name RG-DEMOCLI \
--location westeurope

az group create

--location Parameter>

--location Parameter #

With the following command, we obtain the list of existing locations in Azure.

az account list-locations

As you can see in the screenshot, you can use the online command help with the –help or -h parameter.

az group create
You can check the task by running the following command:

az group list

If you want to know more about Azure Resource Groups, check out this link.