Connect Azure Front Door Premium to a Storage Account origin with Private Link with Azure CLI

This article provides a step-by-step guide on how to configure Azure Front Door Premium to connect to your Storage Account privately using Azure Private Link with Azure CLI.

Prerequisites

Prerequisites:

Note

Private endpoints require your Storage Account to meet specific requirements. For more information, see Using Private Endpoints for Azure Storage.

Run the az afd origin create command to create a new Azure Front Door origin. Use the following settings to configure the Storage Account for private connection. Ensure the private-link-location is in one of the available regions and the private-link-sub-resource-type is blob.

az afd origin create --enabled-state Enabled \
                     --resource-group myRGFD \
                     --origin-group-name og1 \
                     --origin-name mystorageorigin \
                     --profile-name contosoAFD \
                     --host-name mystorage.blob.core.windows.net \
                     --origin-host-header mystorage.blob.core.windows.net \
                     --http-port 80 \
                     --https-port 443 \
                     --priority 1 \
                     --weight 500 \
                     --enable-private-link true \
                     --private-link-location EastUS \
                     --private-link-request-message 'AFD storage origin Private Link request.' \
                     --private-link-resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRGFD/providers/Microsoft.Storage/storageAccounts/mystorage \
                     --private-link-sub-resource-type blob 

Approve Azure Front Door Premium private endpoint connection from Azure Storage

  1. Run the az network private-endpoint-connection list command to list the private endpoint connections for your storage account. Note the Resource ID of the private endpoint connection from the output.

    az network private-endpoint-connection list --name mystorage --resource-group myRGFD --type Microsoft.Storage/storageAccounts
    
  2. Run the az network private-endpoint-connection approve command to approve the private endpoint connection.

    az network private-endpoint-connection approve --id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRGFD/providers/Microsoft.Storage/storageAccounts/mystorage/privateEndpointConnections/mystorage.00000000-0000-0000-0000-000000000000
    
  3. After approval, it can take a few minutes for the connection to be fully established. Once established, Azure Front Door Premium can access your storage account. Public internet access to the storage account is disabled once the private endpoint is enabled.

Note

If the blob or container within the storage account does not allow anonymous access, requests must be authorized. One way to authorize requests is by using shared access signatures.

Next steps

Learn more about Private Link service with storage account.