So I have a storage account and a file share. But I'm having problems when I try to map the network drive using the code provided by Azure in a powershell script. I have nothing else in the script. Just copied and pasted the code. The Test-NetConnection part works fine. And it seems like everything works fine actually.I get this after running the script:
But as you can see in the picture - when I run "net use" I don't see any network drives. Nothing is shown in the Explorer windows either.
If I paste all code direct into the powershell window everything works fine and I get my drive.
Any suggestions? What am I missing?
EDIT: Additional information - I found out that the drive actually is mapped, but as soon as the script is done and not running anymore, it's removed. If I add "pause" at the end of the script the mapped drive is available until I hit enter in the powershell window to exit the script... Maybe that's helpful information for anyone to be able to help out here?
I think I solved this...
By adding -Scope "Global" to the New-PSDrive command the mapped drive stays after the script hos stopped running.