0
votes

I assign resource policy for my key vault in an arm template and everything works fine until I want to assign policy for a app service's deployment slot.

The app service's slot has been created, but in my arm template that assigns access permission (i.e. give the slot permission to access key vault), I use this to get resource id:

"resourceId": {
            "type": "string",
            "defaultValue": "[resourceId(parameters('resourceGroup'), parameters('resourceType'), parameters('resourceName'))]",
            "metadata": {
                "description": "The resource id of the resource to set the policy for. Defaults to the ResourceId function of the resource's resource group, type and name."
            }
        }

I got this error: Unable to evaluate template language function 'resourceId': function requires exactly one multi-segmented argument which must be resource type including resource provider namespace. Current function arguments 'MyResourceGroupName,Microsoft.Web/sites,MyAppServiceName/slots/Pre'.

I am not too sure what should I pass down here, but I will need resourceId so it can be added to the access policy in key vault. As the same arm template works for the normal site, there must be something bit special with slot?

1

1 Answers

1
votes

You must include resource provider name 'Microsoft.Web/Sites/Slots' with the name of Web App and stage name. You have only Web App name.

Try to use this:

"resourceId": {
  "type": "string",
  "defaultValue": "[resourceId('Microsoft.Web/sites/slots', parameters('resourceName'), parameters('stageName'))]"
}