none
Map Azure File Storage where Storage Key contains slashes

    Question

  • Hi all,

    I want to map an Azure File storage to my VM.

    The approach I'm using is described here:
    https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/

    The article says I should use the following line to map the drive:
    net use z: \\samples.file.core.windows.net\logs /u:<storage account name> <storage-account-key>

    This works fine as long as the <storage-account-key> does NOT contain slashes ("/").
    When the key contains slashes, the above command does not work (most likely because it interprets the slash as the beginning of a new command parameter).

    How can I adapt the above line of code to make it work with storage account keys that contain slashes?

    Best,
    Thorsten

    Tuesday, February 23, 2016 7:55 AM

Answers

  • Hello Thorsten,

    I tested this with a key that has slashes in it (mine has two in fact) and it works just fine from the command prompt. My VM is a windows 2008 R2. Here are some alternative approaches you could try

    a) Use * for the password and let it prompt for the password. Enter the key at the password prompt.

    b) Enclose your password in double quotes.

    c) Use cmdkey to persist credentials first as detailed here : https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/#mount-the-file-share

    Cheers
    Ajith


    Ajith Krishnan
    Please let me know if my post was helpful.


    Monday, February 29, 2016 1:13 PM

All replies

  • Hi Thorsten,

    Thank you for posting in here.
    We are currently researching on this and will keep you posted with the findings.
    We appreciate your patience.

    Regards,
    Malar.

    Wednesday, February 24, 2016 7:37 AM
  • Hi Malar,

    could you give me an update on this issue? We are still looking for the solution.

    Best,

    Thorsten

    Monday, February 29, 2016 9:01 AM
  • Hello Thorsten,

    I tested this with a key that has slashes in it (mine has two in fact) and it works just fine from the command prompt. My VM is a windows 2008 R2. Here are some alternative approaches you could try

    a) Use * for the password and let it prompt for the password. Enter the key at the password prompt.

    b) Enclose your password in double quotes.

    c) Use cmdkey to persist credentials first as detailed here : https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/#mount-the-file-share

    Cheers
    Ajith


    Ajith Krishnan
    Please let me know if my post was helpful.


    Monday, February 29, 2016 1:13 PM
  • Hi Ajith,

    thanks for your post. Maybe I need to refine my question:

    the command works if there are slashes in the storage account key unless "/" is not the first character.

    Example:

    net use z: \\samples.file.core.windows.net\logs /u:username my/slashyaccount/key

    Example 2 (does not work):

    net use z: \\samples.file.core.windows.net\logs /u:username /my/slashyaccount/key

    Error Message:

    The option "/my/slashyaccount/key" is unknown.

    I have already tried to enclose the storage account key in " " or \ \ or use ^ as escape character.

    Also I tried the following to enclose the whole string, begining after /u: in " ", which also does not work

    Setting * as password to prompt the user is not feasible since the script is executed as a batch process.

    Any idea?

    Best,

    Thorsten

    Tuesday, March 1, 2016 3:46 PM