Azure-Samples / Azure-Samples/functions-quickstart-dotnet-azd-eventgrid-blob

Push delivery with public network disabled (and private endpoints is not possible)

Open
#11 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
2
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Event grid cannot work with private networking (vnet) and public access disabled (for function app) as push delivery configured in the example means the private endpoint would need to send request to function app, but since event grid has no outbound connectivity to the vnet (e.g. vnet integration like func app has). Private endpoints are only for inbound connections.

This is simply explained in this part of event grid documentation:
https://learn.microsoft.com/en-us/azure/event-grid/consume-private-endpoints
> With push delivery isn't possible to deliver events using [private endpoints](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview). That is, with push delivery, either in Event Grid basic or Event Grid namespaces, your application can't receive events over private IP space. However, there's a secure alternative using managed identities with public endpoints. Use the link in the next section to navigate to the article that shows how to use managed identities to deliver events.

The sample tries to setup push delivery for event grid in `scripts\post-up.ps1`:
```powershell
$endpointUrl="""https://" + ${env:AZURE_FUNCTION_APP_NAME} + ".azurewebsites.net/runtime/webhooks/blobs?functionName=Host.Functions.ProcessBlobUpload&code=" + $blobs_extension + """"

$filter="/blobServices/default/containers/" + ${env:UNPROCESSED_PDF_CONTAINER_NAME}

az eventgrid system-topic event-subscription create -n unprocessed-pdf-topic-subscription -g ${env:RESOURCE_GROUP} --system-topic-name ${env:UNPROCESSED_PDF_SYSTEM_TOPIC_NAME} --endpoint-type webhook --endpoint $endpointUrl --included-event-types Microsoft.Storage.BlobCreated --subject-begins-with $filter

Write-Output "Created blob event grid subscription successfully."
```

Where `--endpoint-type` is `webhook` indicating push deliivery. There is no way this can work unless there is some magic happening outside of VNet. Pull delivery on the function app with a trigger on the other hand seems tricky as well as functions are supposed to be stopped when not receiving messages.

Additionally the deployment with `azd` up failed already at earlier stage and the function app newer gets created. There is no proper message explaining the failure, but retries had the same result.
```
{
"code": "DeploymentFailed",
"target": "/subscriptions//resourceGroups/rg-functions-quickstart-dotnet-azd-eventgrid-blob/providers/Microsoft.Resources/deployments/processor",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "ResourceDeploymentFailure",
"target": "/subscriptions//resourceGroups/rg-functions-quickstart-dotnet-azd-eventgrid-blob/providers/Microsoft.Resources/deployments/processor-flex-consumption",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'."
}
]
}
```

Contributor guide

Open the contributing guide

Research direction

Start with scripts/post-up.ps1 and the Azure Event Grid private-endpoints documentation linked in the issue. Reproduce the azd up deployment failure and inspect the Event Grid subscription configuration; done means the sample's networking and deployment behavior is either made functional or clearly documented with an appropriate alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.