Resource Groups - Create Or Update

Creates or updates a resource group.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}?api-version=2021-04-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters.

Regex pattern: ^[-\w\._\(\)]+$

subscriptionId
path True

string

The Microsoft Azure subscription ID.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Required Type Description
location True

string

The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations.

managedBy

string

The ID of the resource that manages this resource group.

properties

ResourceGroupProperties

The resource group properties.

tags

object

The tags attached to the resource group.

Responses

Name Type Description
200 OK

ResourceGroup

OK - Returns information about the new resource group.

201 Created

ResourceGroup

Created - Returns information about the new resource group.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create or update a resource group

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group?api-version=2021-04-01

{
  "location": "eastus"
}

Sample response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group",
  "name": "my-resource-group",
  "location": "eastus",
  "properties": {
    "provisioningState": "Succeeded"
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group",
  "name": "my-resource-group",
  "location": "eastus",
  "properties": {
    "provisioningState": "Succeeded"
  }
}

Definitions

Name Description
CloudError

An error response for a resource management request.

ErrorAdditionalInfo

The resource management error additional info.

ErrorResponse

Error Response

ResourceGroup

Resource group information.

ResourceGroupProperties

The resource group properties.

CloudError

An error response for a resource management request.

Name Type Description
error

ErrorResponse

Error Response
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorResponse

Error Response

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorResponse[]

The error details.

message

string

The error message.

target

string

The error target.

ResourceGroup

Resource group information.

Name Type Description
id

string

The ID of the resource group.

location

string

The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations.

managedBy

string

The ID of the resource that manages this resource group.

name

string

The name of the resource group.

properties

ResourceGroupProperties

The resource group properties.

tags

object

The tags attached to the resource group.

type

string

The type of the resource group.

ResourceGroupProperties

The resource group properties.

Name Type Description
provisioningState

string

The provisioning state.