Azure文件存储映射到Win10,因为网络驱动器请求在重新启动后登录

Azure文件存储映射到Win10,因为网络驱动器请求在重新启动后登录,azure,powershell,azure-storage,network-drive,Azure,Powershell,Azure Storage,Network Drive,我正在使用Azure文件存储,并已将该存储映射为物理Windows 10 PC上的网络驱动器U。我使用PowerShell装载它: net使用U:\\exampleaccount.file.core.windows.net\filesharename/U:AZURE\exampleaccount AzureAccessKey/persistent:Yes 但是,每次我重新启动电脑时,网络驱动器都会要求我输入与存储帐户关联的凭据 1 Windows不存储最初用于映射驱动器的AzureAccessK

我正在使用Azure文件存储,并已将该存储映射为物理Windows 10 PC上的网络驱动器U。我使用PowerShell装载它:

net使用U:\\exampleaccount.file.core.windows.net\filesharename/U:AZURE\exampleaccount AzureAccessKey/persistent:Yes

但是,每次我重新启动电脑时,网络驱动器都会要求我输入与存储帐户关联的凭据

1 Windows不存储最初用于映射驱动器的AzureAccessKey密钥吗

2每次重新启动系统时自动修复此问题的最简单方法是什么?

请参阅文档,以便在Windows中保留Azure文件共享凭据:

该实用程序允许您在Windows中存储存储帐户凭据。这意味着,当您尝试通过其UNC路径访问Azure文件共享或装载Azure文件共享时,您将不需要指定凭据。要保存存储帐户的凭据,请运行以下PowerShell命令,并在适当的情况下替换和

如果成功存储Azure文件共享的凭据,则预期输出如下:列表中可能存储了其他密钥:

您现在应该能够装载或访问共享,而无需提供其他凭据

$resourceGroupName = "<your-resource-group-name>"
$storageAccountName = "<your-storage-account-name>"

# These commands require you to be logged into your Azure account, run Login-AzAccount if you haven't
# already logged in.
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName
$storageAccountKeys = Get-AzStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName

# The cmdkey utility is a command-line (rather than PowerShell) tool. We use Invoke-Expression to allow us to 
# consume the appropriate values from the storage account variables. The value given to the add parameter of the
# cmdkey utility is the host address for the storage account, <storage-account>.file.core.windows.net for Azure 
# Public Regions. $storageAccount.Context.FileEndpoint is used because non-Public Azure regions, such as sovereign 
# clouds or Azure Stack deployments, will have different hosts for Azure file shares (and other storage resources).
Invoke-Expression -Command ("cmdkey /add:$([System.Uri]::new($storageAccount.Context.FileEndPoint).Host) " + `
"/user:AZURE\$($storageAccount.StorageAccountName) /pass:$($storageAccountKeys[0].Value)")
cmdkey /list
Currently stored credentials:

Target: Domain:target=<storage-account-host-name>
Type: Domain Password
User: AZURE\<your-storage-account-name>