Azure REST API: Get list of all resource groups

We will need a token to run this request. You can follow my previous post to learn how to get a token.

Once the token is acquired, it will be a GET request.

URL: https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups?api-version=2017-05-10

Replace {{subscriptionId}} with your subId.

And added an “Authorization” header with value “Bearer {{bearerToken}}“, replacing¬†{{bearerToken}}¬†with your acquired token.

The response will be a JSON containing a list of all the resource groups in the subscription.

RESPONSE:

{
    "value": [
        {
            "id": "/subscriptions/12324-fsdf345-sdf353-w3w5re/resourceGroups/myrg1",
            "name": "myrg1",
            "location": "australiasoutheast",
            "properties": {
                "provisioningState": "Succeeded"
            }
        },
        {
            "id": "/subscriptions/12324-fsdf345-sdf353-w3w5re/resourceGroups/myrg2",
            "name": "myrg2",
            "location": "centralus",
            "properties": {
                "provisioningState": "Succeeded"
            }
        }   ]
}

 

PS: I will soon be uploading a postman collection.

 

Leave a Reply

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