locked
Connect to Azure file share as a service RRS feed

  • Question

  • I am creating a fail-over environment using azure file share and I am having issues configuring my windows VM with persistent credentials for a windows user and service, I followed the documentation on this link with the help of support with no positive results

    https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows

    Tuesday, December 11, 2018 4:17 PM

All replies

  • For a Windows user, this should be straightforward - as documented in the article you referenced. What is specifically the issue you are running into?

    For a Windows service - this would be more challenging. You could potentially use the approach described in https://support.asperasoft.com/hc/en-us/articles/216127818-How-to-map-network-shares-into-drives-to-a-Windows-service-permanently

    hth
    Marcin

    Tuesday, December 11, 2018 5:09 PM
  • I used the documentation on the link I posted to get at list persistent credentials working under my user login, I used the command below and replaced the first 2 lines with the information requested. Resource group name and storage account name, but when I use the UNC path I still get prompt to access enter credentials

    $resourceGroupName = "<your-resource-group-name>"
    $storageAccountName = "<your-storage-account-name>"
    
    # These commands require you to be logged into your Azure account, run Login-AzureRmAccount if you haven't
    # already logged in.
    $storageAccount = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName
    $storageAccountKeys = Get-AzureRmStorageAccountKey -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)"


    Tuesday, December 11, 2018 5:43 PM
  • Have you tried creating a drive mapping and using a drive letter instead?

    hth
    Marcin

    Tuesday, December 11, 2018 7:30 PM
  • I will give that a try tonight, and report tomorrow, thank you for your help
    Tuesday, December 11, 2018 9:27 PM
  • Just checking in to see if the above response helped to answer your  query. 

    Wednesday, January 9, 2019 6:56 AM