Get Resource Groups

GET {{resource}}/subscriptions/{{subscriptionId}}/resourcegroups?api-version=2021-04-01

Setup Azure credentials on Qodex

Requirements

  1. Azure Cloud with an active subscription.

Getting Started - Step 1

  1. Login to Azure Cloud from https://portal.azure.com/
  2. Open a shell on Azure at https://portal.azure.com/#cloudshell/
  3. Type in az ad sp create-for-rbac - This command will provide the credentials we need to work on Qodex to test some Azure API:
    1. AppID
    2. displayname
    3. Password
    4. Tenant
  4. Copy the credentials to somewhere safe. Please do not expose the credentials! You can also explore other roles when creating a service principal by using the --role flag and setting it to roles in Azure.
  5. The example of service principal details are as below:
{
  "appId": "e8df7f8a-0278-4c18-894d-cef025ea3f0f",
  "displayName": "azure-cli-2023-06-08-16-49-34",
  "password": "Kau8Q~a7u1CvIxz9E.vyYxahXlWoUjkpCRwggaTQ",
  "tenant": "84c31ca0-ac3b-4eae-ad11-519d80233e6f"
}

To get the ID for the SP credentials, you can run the get-AzADServicePrincipal -DisplayName $name. replace the $name with the displayName found from the previous output.

Example:

PS /home/muhammad> get-AzADServicePrincipal -DisplayName azure-cli-2023-06-08-16-49-34
DisplayName                   Id                                   AppId
-----------                   --                                   -----
azure-cli-2023-06-08-16-49-34 7498be74-f45f-419e-a1c7-0451ce5aec4d e8df7f8a-0278-4c18-894d-cef025ea3f0f

Get the subscription ID for your Azure Instance.

On the Azure CLI, type az account show --query id -o tsv. The output should look like:

PS /home/muhammad> az account show --query id -o tsv                                                                                                                                  
2194342b-7189-4260-9490-0ef921f337f0

Step 2 - Rocking with Qodex!

Create variables on the Environment Tabs on Qodex and map them with the Service Principle and Subcription ID output from earlier.

ClientId = AppID

clientSecret = Password

tenantId = tenant

resource = https://management.azure.com/

subscriptionId = XXXX

Request Params

KeyDatatypeRequiredDescription
api-versionstring

RESPONSES

status: OK

{"value":[{"id":"/subscriptions/6a57dd83-e66f-4f92-9582-29222cd6ac4a/resourceGroups/Postman-Azure","name":"Postman-Azure","type":"Microsoft.Resources/resourceGroups","location":"westus","properties":{"provisioningState":"Succeeded"}},{"id":"/subscriptions/6a57dd83-e66f-4f92-9582-29222cd6ac4a/resourceGroups/AzureRestResourceGroup","name":"AzureRestResourceGroup","type":"Microsoft.Resources/resourceGroups","location":"westus","properties":{"provisioningState":"Succeeded"}}]}