简体   繁体   中英

Cannot get Azure Storage Account File Share mapped on VM using PowerShell

Trying to get an Azure fileshare (in 'ResourceGroup1') mapped to a drive letter using powershell: New-PSDrive –Name 'Z' –PSProvider FileSystem –Root '\\\\sa1.file.core.windows.net\\solutionfiles' .

I keep getting error " New-PSDrive : The specified drive root "\\\\sa1.file.core.windows.net\\solutionfiles" either does not exist, or it is not a folder ". But is exists!

'New-PSDrive' gives an unwanted pop-up when adding a '-Credential' parameter even if I provide a PSCredential object. When I enter SAName and SAKey manually then the mapping works. However, for an automation I cannot use a pop-up. What to do?

Just used the following feeling lucky:

Invoke-Expression -Command "cmdkey /add:SA1.file.core.windows.net /user:Azure\sbl266aucy3e2sa01 /pass:SAKey

No idea yet what this is doing ('cmdkey'???), but it hands over the credentials somehow to ??? so that the original cmdlet to map a drive now works:

New-PSDrive -Name Z -PSProvider FileSystem -Root "\\sbl266aucy3e2sa01.file.core.windows.net\solutionfiles"

//

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM