Я работаю с хранилищем файлов Azure и сопоставляю хранилище как сетевой диск U на моем физическом ПК с Windows 10. Я монтирую его с помощью PowerShell:
net use U: \\exampleaccount.file.core.windows.net\filesharename /u:AZURE\exampleaccount AzureAccessKey /persistent:Yes
Однако каждый раз, когда я перезагружаю свой компьютер, сетевой диск запрашивает ввод учетных данных, связанных с учетной записью хранения.
1) Разве Windows не хранит ключ AzureAccessKey, изначально использовавшийся для сопоставления диска?
2) Какой самый простой способ автоматически исправить это каждый раз при перезагрузке системы?


Обратитесь к документу здесь, чтобы сохранить учетные данные файлового ресурса Azure в Windows:
The cmdkey utility allows you to store your storage account credentials within Windows. This means that when you try to access an Azure file share via its UNC path or mount the Azure file share, you will not need to specify credentials. To save your storage account's credentials, run the following PowerShell commands, replacing
<your-storage-account-name>and<your-resource-group-name>where appropriate.
$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)")
You can verify the cmdkey utility has stored the credential for the storage account by using the list parameter:
cmdkey /list
If the credentials for your Azure file share are stored successfully, the expected output is as follows (there may be additional keys stored in the list):
Currently stored credentials:
Target: Domain:target=<storage-account-host-name>
Type: Domain Password
User: AZURE\<your-storage-account-name>
You should now be able to mount or access the share without having to supply additional credentials.