I have a powershell script which runs in an Azure VM which connects to Azure blob storage and Azure SQL. Both the blob storage and SQL are protected by a firewall, the blob storage is part of a VNet. The VM is on its own VNet. I have the IP address of the VM inserted in both azure storage and sql azure. The access to SQL Azure is fine, however when I try to connect to blob storage I get the error message
"Get-AzStorageContainer : This request is not authorized to perform this operation. HTTP Status Code: 403 - HTTP Error Message: This request is not authorized to perform this operation. ErrorCode: AuthorizationFailure".
I am using a connection string to access the blob storage. If I connect from my PC (the IP address of which is entered in the firewall) I can get access no problem. If I access blob storage from the VM using the connection string in azure storage explorer I get the same error message.
If I disable the firewall on the blob storage then I can access it fine from the VM using both powershell and storage explorer.
Not sure if this is relevant but if I execute Get-NetIPAddress | Format-Table
on the VM I get a Ipv6 ip address reported instead of the IPv4 I use everywhere else and in the firewall.
This might be relevant but no idea how to prove it one way or the other: Azure Storage account firewall rules work for table but break blob storage
Can anyone suggest a reason for this strange behaviour? How can I get reliable access to blob storage from the VM without having to disable the firewall?