The functionApp has already been deployed successfully. When attempting to use an Azure DevOps inline powershell script with New-AzDeployment to deploy the following ARM template:
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {
"location": {
"type": "string",
"defaultValue": "westus2",
"metadata": {
"description": "The region where resources are deployed"
}
},
"functionAppName": {
"type": "string",
"defaultValue": "event-driven-func2",
"metadata": {
"description": "Func App"
}
},
"eventGridSubscriptionName": {
"type": "string",
"defaultValue": "eventSub1",
"metadata": {
"description": "Name of Event Grid Subscription"
}
},
"eventGridFunc":{
"type": "string",
"defaultValue": "VmAddedListener",
"metadata": {
"description" : "Function Name"
}
}
},
"variables": {
"functionUrl" : "[concat('https://', parameters('FunctionAppName'),'.azurewebsites.net/runtime/webhooks/eventgrid?functionName=', parameters('eventGridFunc'),'&code=')]"
},
"resources": [
{
"apiVersion": "2018-01-01",
"type": "Microsoft.EventGrid/eventSubscriptions",
"name": "[parameters('eventGridSubscriptionName')]",
"location": "[parameters('location')]",
"properties": {
"destination": {
"endpointType": "Webhook",
"properties": {
"endpointUrl": "[concat(variables('functionUrl'), listKeys(resourceId('Microsoft.Web/sites/host/', parameters('functionAppName'), 'default'),'2016-08-01').masterKey)]"
}
},
"filter": {
"subjectBeginsWith": "",
"subjectEndsWith": "",
"isSubjectCaseSensitive": false,
"includedEventTypes": [
"Microsoft.Resources.ResourceActionCancel",
"Microsoft.Resources.ResourceActionFailure",
"Microsoft.Resources.ResourceActionSuccess",
"Microsoft.Resources.ResourceDeleteCancel",
"Microsoft.Resources.ResourceDeleteFailure",
"Microsoft.Resources.ResourceDeleteSuccess",
"Microsoft.Resources.ResourceWriteCancel",
"Microsoft.Resources.ResourceWriteFailure",
"Microsoft.Resources.ResourceWriteSuccess"
]
}
}
}
],
"outputs": {}
}
Getting the following error during the release:
"error": { "code": "ResourceNotFound", "message": "The Resource 'Microsoft.Web/sites/abc-rg' under resource group '' was not found." } }'
Do I need to specify the resource group some where in ARM?