0

Im using azure devops release pipeline. Im planning to map the azure Fileshare to all VMS in deployment groups. I have the script from the portal to map fileshare in local. Replacing the passkey value in that script I'm passing as variable. Tried to check and the value is getting. But in results it shows mapped with the drive letter. When I opened the file explorer it shows disconnected and unable to eject the sharepath shows "This network connection does not exist" Also it is not even mapped. If any issue in getting keys from variable means it should throw error without showing drive create status.

Looking for help is any step or mistake happened in the pipeline? Or in script?

Note: in local i can able to run the script successful and drive mapped successful as well.

Script: cmd.exe /C "cmdkey /add:"storageaccount.file.core.windows.net" /user:"localhost\storageaccount" /pass:"accesskeyforstorageaccount" New-PSDrive -Name Z -PSProvider Filesystem -Root "\storageaccount.file.core.windows.net\fileshare-name" -Persist

User100289
  • 21
  • 1

1 Answers1

0
  1. Make sure the drive name Z is not taken on Deployment group VM.

  2. When you say in local i can able to run the script successful, do you mean you run on the deployment group VM? If not, try to run the script to check if it's successfully, check network, port.

  3. You can check the code sample which is successful, double check if password is correctly set if you are using secret variable in the pipeline.

If the issue persists, please share more info like screenshot, log.

wade zhou - MSFT
  • 1,397
  • 1
  • 3
  • 6
  • The issue was resolved when I added the remove-psdrive in the same task, first it map the drive with keys and adding commands to copy from the mapped drive and at the end of the line once after all the tasks completed i gave remove-psdrive. – User100289 Dec 12 '22 at 01:15
  • Glad to know it's resolved. Check the [doc](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-psdrive?view=powershell-7.2#description) for `remove-psdrive`, the command will delete temporary PowerShell drives that were created by using the `New-PSDrive` cmdlet, so for your issue, actually the `drive Z` is not needed after the pipeline task, is it correct? – wade zhou - MSFT Dec 12 '22 at 01:57
  • Yes, i need to use the task to copy from the share it is temporary need to access the share for copying files – User100289 Jan 10 '23 at 01:58