Close

ARM resourceId Function

The syntax of the resourceid function is as follows:
resourceId(<subscriptionID>,<ResourceGroupName>,<Resource-Type>, <ResourceName1>,<ResourceName2>)

In its basic form, we need to provide just two pieces of information to the resourceId function: Resource type and resource name. We must add add subscription id and resource group name in situations where the resource is in a different resource group.

Example: KeyVaultAccessPolicy that references API Management instance:

resourceId(subscription().subscriptionId, resourceGroup().name, ‘Microsoft.ApiManagement/service’, parameters(‘apiManagementName’))

Note that in this case subscriptionId and resourceGroupName could have been left out, because KeyVault and API Management are in the same resourcegroup. I left the example as is, because it shows the correct syntax. The short notation would be:
resourceId(‘Microsoft.ApiManagement/service’, parameters(‘apiManagementName’))

You can use the Resource Explorer in the Azure Portal to find the ID of a resource.

See: Techgenix.com