resource rawStorageAccount 'Microsoft.Storage/storageAccounts@2021-08-01' existing = { name: 'mystorageaccount' scope: 'rg3' } resource eventHubNamespace 'Microsoft.EventHub/namespaces@2021-11-01' existing = { name: 'myeventhub' scope: 'rg2' } resource eventHubNamespaceName_eventHubName 'Microsoft.EventHub/namespaces/eventhubs@2021-11-01' existing = { parent: eventHubNamespace name: 'ehname' } resource eventHubNamespaceName_eventHubName_Listen 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2021-11-01' = { parent: eventHubNamespaceName_eventHubName name: 'ConsumerListens' properties: { rights: [ 'Listen' ] } } resource functionApp 'Microsoft.Web/sites@2020-06-01' = { //func settings } var roleDefinitionDataReceiverId = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a638d3c7-ab3a-418d-83e6-5f17a39d4fde') resource functionAppPermissionsEventHub 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = { name: guid(functionAppName, roleDefinitionDataReceiverId) scope: eventHubNamespaceName_eventHubName properties: { principalId: functionApp.identity.principalId roleDefinitionId: roleDefinitionDataReceiverId } } var roleDefinitionBloblContributorId = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') resource functionAppPermissionsAdlsGen2 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = { name: guid(functionApp.id, roleDefinitionBloblContributorId) scope: storageAccount properties: { principalId: functionApp.identity.principalId roleDefinitionId: roleDefinitionBloblContributorId } }