How to move files with "AzureBlob Copy Files" in the build steps, naming blob by date.


  • Hi everyone,

    I'm using AzureBlob Copy Files in the build steps to upload my release files into a container but I would like to name the blob with the current date. I tried $(date:yyyyMMdd) with no success. Is there a way to do that?

    Tuesday, August 30, 2016 9:13 PM

All replies

  • Hi -

    Container names must meet these requirements. So you might be able to use dashes to separate the date parts in your name (e.g., 2016-08-30). However, you can't use a colon or an upper-case character.

    Here are the rules:

    A container name must be a valid DNS name, conforming to the following naming rules:

    1. Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.

    2. Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in container names.

    3. All letters in a container name must be lowercase.

    4. Container names must be from 3 through 63 characters long.

    • Proposed as answer by Bhushan Gawale Wednesday, August 31, 2016 3:11 AM
    Tuesday, August 30, 2016 11:39 PM
  • I used Build.BuildId that get the number of the current build, but I want the date. I'm asking for a parameter such as $(date:yyyyMMdd) or a way to rename the container name by powershell script.

    Wednesday, August 31, 2016 12:31 PM
  • Hi -

    I think I misunderstood your question above. Are you trying to create a container or a blob? Can you provide an example of an actual string that you are trying to use to create the blob (not just the parameter format)?

    Blob naming rules are more flexible than container naming rules. See here for blob naming rules.

    There's no way to rename a container once it's been created. You can only create a new one. To rename a blob, you can copy it to a new blob.

    Also, if you're asking for how to get the date from the build information, we can't help you with that here; this forum is only for Azure Storage questions.

    Wednesday, August 31, 2016 2:56 PM