The 403 error you are encountering when trying to access the Azure Blob Storage from your Azure Automation runbook indicates an authorization failure. Here are some potential causes and solutions to consider:
- Network Restrictions: Since both the storage account and the automation account have a private endpoint and public access is disabled, ensure that the Azure Automation runbook is configured to access resources through the virtual network. If the Azure Firewall is enabled on the storage account, it may block access from Azure Automation runbooks. You might need to use a Hybrid Runbook Worker to facilitate this access.
- Role Assignments: Although you mentioned that the managed identity of the automation account has the "Storage Blob Data Contributor" role, ensure that this role is assigned at the correct scope (e.g., storage account level). Also, verify that there are no additional role restrictions that might be affecting access.
- Run As Account Permissions: If you are using a Run As account, ensure that it has the necessary permissions to access the storage account. The Run As account might not have the same permissions as the managed identity.
- Check for IP Restrictions: Ensure that there are no IP address restrictions that could be blocking access to the storage account from the automation account.
- Service Endpoint Configuration: Confirm that the service endpoint for Azure Storage is correctly configured in your virtual network settings.
By reviewing these areas, you should be able to identify the root cause of the 403 error and resolve the issue.
References: