Resource Group can be used to control access by RBAC (Role-Based Access Control), assign policies, Cost Analysis and Deployment.
Click on + Add which will launch Resource Group creation blade.
Select Subscription, provide Resource Group name and region/location where the schema of the resource group should reside.
We are not going to discuss Tags now, goto review + create which validates the data provided. If all is good Validation passed message will be displayed in green. If there are any error need to fix them for successful validation.
Use Create option for the creation of Resource Group.
Successful creation of Resource Group will be notified (Check for bell Icon in the portal to see current or past notifications).
Navigate to Resource Group service and select Resource Group created, you see it as below.
Below are the Powershell commands related to Resource Group.
Powershell commands that are used for the creation/deletion of ResourceGroups don’t have Subscription as a parameter. If there are multiple Subscriptions use the Select-Subscription command to select the Subscription on which you would like to work with ResourceGroups.
Get the list of Subscriptions:
Get-Subscription
Switch between Subscriptions:
Select-AzSubscription -Subscription Subscriptionname
New-AzResourceGroup -Name MyRG -Location ‘Central US’
Remove Resource Group “MyRG”:
Remove-AzResource -Name MyRG
Get the Resource Groups in current Subscription:
Get-AzResourceGroup
Remove all the Resource Groups in the current Subscription:
$getrg = Get-AzResourceGroup
foreach($rg in $getrg)
{
$rg ResourceGroupName
Remove-AzResourceGroup -Name $rg.ResourceGroupName -Verbose
}
or
Get-AzResourceGroup | Remove-AzResourceGroup -Verbose