azure run command script to mount file storage azure run command script to mount file storage azure azure

azure run command script to mount file storage


For me, the issue was that, according to the Azure docs, "scripts run as System on Windows." So when you login as your normal user, that user doesn't have the credentials saved, and can't view the mounted drive contents.

To workaround this, you can use psexec (from the PSTools package) to run as your regular user. For example:

psexec.exe \\your-ip -u your-user -p your-pass cmdkey /add:...psexec.exe \\your-ip -u your-user -p your-pass net use Z: \my123storageaccount.file.core.windows.net\databases /u:AZURE\my123storageaccount sskhgkghgkuytiytru...==

Note: Due to voodoo black magic, you have to use the form of psexec.exe \\your-ip rather than just psexec.exe as System user, or risk upsetting Billy Goates.


You can copy files like this. The powershell commands can be copied from Azure, using 'connect' from the context menu of the share in the Azure portal. If this doesn't work could be connectivity or may be SMB related

$buildSource = 'M:\build\'$acctKey = ConvertTo-SecureString -String "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -AsPlainText -Force$credential = New-Object System.Management.Automation.PSCredential -ArgumentList "Azure\wserverBuild", $acctKeyNew-PSDrive -Name M -PSProvider FileSystem -Root "\\wserverBuild.file.core.windows.net\build" -Credential $credential -PersistCopy-Item  'M:\build\' -Destination 'C:build' -Recurse


if you go to the storage account -> files you can copy the powershell commands you need to map the drive.

enter image description here