Access denied (mapping file share)

does anyone have any ideas?
I am trying to map a drive on a VM.
I have added the VNET for the VM to the Storage account.
The VM has contributor role assigned on the storage account. ANy pointers would be gr8!!
PS C:\Windows\system32> $connectTestResult = Test-NetConnection -ComputerName mystraccnt.file.core.windows.net -Port 445
PS C:\Windows\system32> if ($connectTestResult.TcpTestSucceeded) {

Save the password so the drive will persist on reboot

cmd.exe /C “cmdkey /add:"mystraccnt.file.core.windows.net” /user:"localhost\mystraccnt" /pass:`“passwrd”"

Mount the drive

New-PSDrive -Name Y -PSProvider FileSystem -Root “\mystraccnt.file.core.windows.net\myshare1” -Persist
} else {
Write-Error -Message “Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S V
PN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port.”
}

CMDKEY: Credential added successfully.
New-PSDrive : Access is denied
At line:5 char:5

  • New-PSDrive -Name Y -PSProvider FileSystem -Root "\mystraccnt …
  • CategoryInfo : InvalidOperation: (Y:PSDriveInfo) [New-PSDrive], Win32Exception
  • FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand