Disconected File shares when using artifacts

Mohamad CHHIMI 66 Reputation points
2021-05-17T15:00:20.667+00:00

Hello,

I'm using a custom artifact that i create to installe a software on my VMs.
I tested the PowerShell script directly over the VM without using artifacts and it's work fine.

In the artifact i use the provided PowerShell code by AZURE for connecting a network drive created with the service "File shares" of a storage account. if i launch this code directly over the VM the drive is correctly connected. But when I'm using this code in the artifacts to connect the network drive, it appear as disconnected when I'm connected to the VM with RDP.

The code is :
**-----------------------------------------------------------------------------------------------------------------
$connectTestResult = Test-NetConnection -ComputerName apoclab505.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
# Save the password so the drive will persist on reboot
cmd.exe /C "cmdkey /add:"apoclab505.file.core.windows.net" /user:"Azure\apoclab505" /pass:"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX""
# Mount the drive
New-PSDrive -Name Z -PSProvider FileSystem -Root "\apoclab505.file.core.windows.net\sharedfolder" -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 VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
}

-------------------------------------------------------------------------------------------------------------------
**

in the following photo you can see that the DVD that i hosted on the network Drive has been correctly mounted and the software has correctly installed. The issue is that just the network drive appears as disconnected.
97120-disconnected-network-drive.png

Have you encounter such problems when using artifacts ? How can I resolve this issue.

Best regards
Mohamad

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,163 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,687 questions
Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
255 questions
0 comments No comments
{count} votes

Accepted answer
  1. kobulloc-MSFT 23,341 Reputation points Microsoft Employee
    2021-05-20T05:27:46.137+00:00

    I went through the same steps and created a file share using an Azure storage account:
    https://learn.microsoft.com/en-us/azure/storage/files/storage-files-quick-create-use-windows

    Like you, I ran the script and was able to access the file share:

    98865-image.png

    I believe the issue is with the custom artifact. I'll reach out to you directly if you are comfortable sharing it and see if I can't troubleshoot this further.

    0 comments No comments

0 additional answers

Sort by: Most helpful