Azurestorageexplorer: Accessing blob container with "$" (dollar sign) in name (i.e., $web)

Created on 29 May 2018  路  30Comments  路  Source: microsoft/AzureStorageExplorer

Storage Explorer Version: 1.1.0
Platform: Windows
Architecture: ia32
Build Number: 20180507.1
Commit: bcc8990d
Regression From: N/A

Steps to Reproduce:

  1. Create GPV2 storage account in West Central US.
  2. Enable private preview of Azure Static Websites
  3. Configure Static Website for the storage account - this creates a blob container named "$web"
    (https://myblobstore.blob.core.windows.net/$web/)
    "An Azure Storage container has been created to host your static website.
    $web"
  4. In Azure Storage Explorer, drill into the storage account, Blob Containers.

Expected Experience:

I should see a list of containers.

Actual Experience:

Blob Containers just shows "Loading..."
I'm not able to see the $web container or any other containers.

I tried using Azcopy 7.1.0, also, and it fails with "Invalid location" for the destination.

I can upload a file via the Azure Portal's Storage Explorer.
So, hello world https://ufifstatic01.z4.web.core.windows.net/

Thanks.

static websites

Most helpful comment

FWIW

206c206
<   if (!nameError || containerName.match(/^(\$root|\$logs)$/)) {
---
>   if (!nameError || containerName.match(/^(\$root|\$logs|\$web)$/)) {

All 30 comments

PS D:> Get-AzureStorageContainer -Context $ctx

Blob End Point: https://ufifstatic01.blob.core.windows.net/

Name    PublicAccess LastModified
----    ------------ ------------
$web    Off          2018-05-28 17:13:57Z
tempweb Off          2018-05-28 21:51:37Z

PS D:> Get-AzureStorageContainer -Context $ctx -Name '$web'
Get-AzureStorageContainer : Container name '$web' is invalid. Valid names start and end with a lower case letter or a number and has in between a lower case letter, number or dash with no consecutive dashes and is 3 through 63 characters long.

According to the Azure documentation, blob containers can't have a $ character in their name.

However, we're working on adding support for Static Websites. Stay tuned!

@MRayermannMSFT, do you have any details on this?

Yes I do! So we're waiting on the NodeJS Client library to ship a version which supports $web containers. If you look at this file in their library, you can see an example of the type of validation they do regarding $ containers. It looks like they've already checked in support and shipped a preview version though, so it hopefully won't be long until they go public, at which point we'll feel comfortable consuming the bits.

In the meantime, if you'd like to do so, you can patch their JS to enable support now! Simply look for that file in the Storage Explorer install directory, and add $web to any of the regex's where $root also appears. Let me know if you need help with that. 馃槃

Thanks, I updated this file as suggested and all is working - I can see all containers and can upload to the $web container.

C:\Program Files (x86)\Microsoft Azure Storage Explorer\resources\app\node_modules\azure-storage\lib\common\util\validate.js

Thank you.

Sweet, glad to know it worked! We'll update/close this issue once we update the library and ship it.

FWIW

206c206
<   if (!nameError || containerName.match(/^(\$root|\$logs)$/)) {
---
>   if (!nameError || containerName.match(/^(\$root|\$logs|\$web)$/)) {

FYI, this issue was created to track AzCopy support for $web

Quick update. The NodeJS library has shipped a non-preview version that supports $web. We've integrated it and will be shipping it in our next update. Thank you everyone for your patience!

Thanks for letting us know @MRayermannMSFT, sounds good!

This also occurs for uploading via powershell:

``# upload a file Set-AzureStorageBlobContent -File "D:\_TestImages\Image001.jpg"
-Container $containerName -Blob "Image001.jpg"
-Context $ctx

upload another file

Set-AzureStorageBlobContent -File "D:_TestImages\Image002.png" -Container $containerName
-Blob "Image002.png" `
-Context $ctx```

Let me know if you'd like me to open a separate issue.

Can I ask a question here, no disrespect intended but seeing as I'm not the only person to lose time on this...
Why are we validating container names against a hard-coded whitelist in the first place?

It seems like a missed opportunity MS teams across different parts of the org didn't catch this in advance and subsequently multiple customers were negatively impacted.
There's a lesson here involving Conway's law...don't mean to be presumptuous but I'd suggest the MS devs on this thread would be well served by zooming out and looking at how this happened.

Introducing some form of cross org integration testing seems like a good idea here.

No offense intended just one guy's opinion

Thank you for the feedback. We are aware of the timing issue. Definitely will learn from this experiences in the future. The choices for Storage Explorer was to release a GA product (Storage Explorer) with a preview back-end library at the same time the static website services became available or to release a GA product with a GA back-end library few days later for quality purpose. We decided to go with the GA library. We are aiming to release a version of Storage Explorer with the static website support this week. Thanks for being patient with us. If you are blocked with uploading/downloading, please consider using the Storage extension for VS Code (preview) as a workaround. Thanks again for the feedback.

@jinglouMSFT we are waiting :). Thank you for fix.

Regards.

Now that 1.3.0 has shipped, I'm going to close this issue.

@noelstieglitz did you open an issue for the Azure RM powershell cmdlet issue by any chance? I am running into that issue now.

@praneetloke - no, I did not.

Have the same problem in DevOps pipeline with AzureBlobCopy command.

[error]Upload to container: '$web' in storage account: 'blob' with blob prefix: '' failed with error: 'Azure Storage container names can only contain lowercase alpha-numeric characters or hyphens

Hi, have any one found the solution to address this in Powershell. I still see the issue when accessing the container $Web.
image

@veereshrev, this is not a general solution but a specifically-coded work-around for static websites that worked for me was to escape it in the PS script (as part of a custom task). There's context missing here (I can't paste all of the task), but the gist of it is that you do a hard-coded replacement in your destination by escaping it.

#Blob Storage Static Websites uses a $web container but the dollar sign indicates a variable in PowerShell. Just using $web would attempt to evaluate a value, which does not exist.
#There are a number of ways to fix this, but this hack may just be the simplest, albeit the most specific.
$web = "`$web"

You can also just put '$web' in single quotes, in which case PowerShell will treat it as a literal string, not a variable.

This is still an issue when running scripts in deployment pipelines however when running locally I dont get the error and the scripts work fine.

I'm just running Set-AzureStorageBlobContent in an Azure Powershell container in a deployment pipeline and wacko it complains about the $web.

Does anyone have a fix for this?

@interthingy No fix so far, I'm also running into this.

Reopening due to user reports. @v-xuanzh, can you folks verify this in your testing?

Closing due to the recent comments being about products other than Storage Explorer.

If you're having issues with the Azure CLI you can find their repo here: https://github.com/Azure/azure-cli

Unfortunatley I'm not sure the right place to send y'all for giving feedback on Azure DevOps. 鈽癸笍 I'll keep looking around, but if one of y'all ends up finding a good spot, feel free to leave a comment and let the rest of us know!

I don't think this is solved. I cannot do this:

Get-AzureStorageBlob -Container '$web'

Error is:

2019-08-22T13:43:12.3747323Z Get-AzureStorageBlob : Container name '$web' is invalid. Valid names start and end with a lower case letter or a 
2019-08-22T13:43:12.3748036Z number and has in between a lower case letter, number or dash with no consecutive dashes and is 3 through 63 
2019-08-22T13:43:12.3748387Z characters long.
2019-08-22T13:43:12.3748630Z At D:\a\_temp\980fef1b-4d2d-4bdf-ab32-98a09eb25889.ps1:10 char:10
2019-08-22T13:43:12.3748838Z + $Blobs = Get-AzureStorageBlob -Context $Context -Container $Container ...
2019-08-22T13:43:12.3749155Z +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-08-22T13:43:12.3749335Z     + CategoryInfo          : InvalidArgument: (:) [Get-AzureStorageBlob], ArgumentException
2019-08-22T13:43:12.3749538Z     + FullyQualifiedErrorId : ArgumentException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlo 
2019-08-22T13:43:12.3749715Z    bCommand

@johnjbateman Looks like you're using Azure PowerShell. This page is for Storage Explorer errors, and we don't use PowerShell in any way.

where should this issue be opened? I am running into the same problem. I am trying to delete the contents of the $web container from DevOps release pipe upon releasing a new version of an application

I don't think this is solved. I cannot do this:

Get-AzureStorageBlob -Container '$web'

Error is:

2019-08-22T13:43:12.3747323Z Get-AzureStorageBlob : Container name '$web' is invalid. Valid names start and end with a lower case letter or a 
2019-08-22T13:43:12.3748036Z number and has in between a lower case letter, number or dash with no consecutive dashes and is 3 through 63 
2019-08-22T13:43:12.3748387Z characters long.
2019-08-22T13:43:12.3748630Z At D:\a\_temp\980fef1b-4d2d-4bdf-ab32-98a09eb25889.ps1:10 char:10
2019-08-22T13:43:12.3748838Z + $Blobs = Get-AzureStorageBlob -Context $Context -Container $Container ...
2019-08-22T13:43:12.3749155Z +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-08-22T13:43:12.3749335Z     + CategoryInfo          : InvalidArgument: (:) [Get-AzureStorageBlob], ArgumentException
2019-08-22T13:43:12.3749538Z     + FullyQualifiedErrorId : ArgumentException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlo 
2019-08-22T13:43:12.3749715Z    bCommand

I would appreciate the help too. This article had pretty early replies from @joegasper regarding Azure Powershell.

@johnjbateman I think you want https://github.com/Azure/azure-powershell.

@dannomayer I created issue 9897 on the Azure Powershell GitHub.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cbailiss picture cbailiss  路  6Comments

timoklimmer picture timoklimmer  路  6Comments

fforcen picture fforcen  路  3Comments

OffColour picture OffColour  路  4Comments

jorgklein picture jorgklein  路  4Comments