microsoft / AzureStorageExplorer

Easily manage the contents of your storage account with Azure Storage Explorer. Upload, download, and manage blobs, files, queues, tables, and Cosmos DB entities. Gain easy access to manage your virtual machine disks. Work with either Azure Resource Manager or classic storage accounts, plus manage and configure cross-origin resource sharing (CORS) rules.
Creative Commons Attribution 4.0 International
370 stars 85 forks source link

Add option to change the default domain (localhost) when connecting to Azure Storage Emulator. #1385

Open diegonzls opened 5 years ago

diegonzls commented 5 years ago

Where I work we run azure storage emulator on a custom IP address instead of localhost, some people run it on a specific domain name. The problem is that there seems to be no way to change the connection string in the Storage Explorer unless you manually modify this file:

C:\Program Files (x86)\Microsoft Azure Storage Explorer\resources\app\out\CloudHub\js\Providers\Azure\Producers\AzureStorageProducer.js

Changing the connection string in that file seems to solve the problem but to be honest it would be better to be able to do this through the UI.

craxal commented 4 years ago

@diegonzls The default emulator location for most users is the local host, but you shouldn't have to change that. The only difference between the Emulator node and any other node is the Emulator node has a predefined connection string. If you have a connection string to your emulator, you can connect to it the exact same way as you would to any Azure resource.

jongio commented 4 years ago

We are adding support for HTTPS to Azurite and with so, the recommended hostname is localhost instead of 127.0.0.1.

I would like us to allow a user to specify a hostname override on this form:

image

craxal commented 4 years ago

@jongio Gotcha. We can consider that in a future version.

johndeverall commented 1 year ago

Please do consider this.

I'm getting this issue when attempting to connect to Azurite using Storage Explorer now due this host name issue.

Unable to retrieve child resources.

Details:
{
  "name": "FetchError",
  "message": "request to https://127.0.0.1:10000/devstoreaccount1?comp=list&include=metadata failed, reason: Hostname/IP does not match certificate's altnames: IP: 127.0.0.1 is not in the cert's list: ",
  "stack": "FetchError: request to https://127.0.0.1:10000/devstoreaccount1?comp=list&include=metadata failed, reason: Hostname/IP does not match certificate's altnames: IP: 127.0.0.1 is not in the cert's list: \n    at ClientRequest.<anonymous> (C:\\Users\\XXXXXX\\AppData\\Local\\Programs\\Microsoft Azure Storage Explorer\\resources\\app\\node_modules\\se-blob-extension\\dist\\src\\index.js:2:2441854)\n    at ClientRequest.emit (node:events:513:28)\n    at TLSSocket.socketErrorListener (node:_http_client:481:9)\n    at TLSSocket.emit (node:events:513:28)\n    at emitErrorNT (node:internal/streams/destroy:157:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:122:3)\n    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)",
  "type": "system",
  "errno": "ERR_TLS_CERT_ALTNAME_INVALID",
  "code": "ERR_TLS_CERT_ALTNAME_INVALID"
}

DefaultAzureCredential appears to only support https so I am pretty screwed in terms of setting up a local dev environment with Azurite and Storage Explorer as far as I can see, unless I take some fairly unpalatable options.

One of either:

  1. Proxying locally.
  2. Hacking source code of Storage Explorer (although the above fix no longer seems to apply to the current version of storage explorer).
  3. Creating certificates for development that include an IP address as a host.
ProTip commented 1 month ago

As a workaround you can add a new connection using a modified default connection string:

AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=https;BlobEndpoint=https://localhost:10000/devstoreaccount1;QueueEndpoint=https://localhost:10001/devstoreaccount1;TableEndpoint=https://localhost:10002/devstoreaccount1;

This has worked fine for me with no errors using exported dotnet dev certs.