Skip to content

Azure Storage should expose a "WithStorageExplorer" API #3778

Closed as not planned
Closed as not planned

Description

Similar to pgAdmin and RedisCommander, it would be convenient to expose an Azure Storage Explorer webpage (similar to the one in the Azure Portal) that allows us to browse our Azurite emulator managed instances

Activity

  1. ghost added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Apr 17, 2024
  2. davidfowl commented on Apr 17, 2024

    @davidfowl
    Collaborator

    That sounds great, how would it work? Is there a container that runs the storage explorer that exposes an http endpoint?

  3. csharpfritz commented on Apr 17, 2024

    @csharpfritz
    Author

    The team has a slimmed down version that runs in the Azure Portal. I don't think its available as a container though.

    I'm exploring the image at https://github.com/sebagomez/azurestorageexplorer to attach and work with my Aspire hosted Azure Storage instances

  4. csharpfritz commented on Apr 18, 2024

    @csharpfritz
    Author

    I am having a hard time getting that StorageExplorer container connected with a proper connectionstring to a host Azurite emulator.

    Any ideas how to pull the connectionstring in AppHost and pass it as an environment variable?

  5. davidfowl commented on Apr 18, 2024

    @davidfowl
    Collaborator

    Show me what you have currently?

  6. csharpfritz commented on Apr 18, 2024

    @csharpfritz
    Author

    I've added the following into AppHost, but I can't seem to get the connectionstring passed along. I've tried to grab fragments with no luck

    AppHost/Program.cs:

    var storage = builder.AddAzureStorage("storage");
    if (builder.Environment.IsDevelopment())
    {
    	storage.RunAsEmulator(config =>
    	{
    		if (Environment.OSVersion.Platform == PlatformID.Win32NT)
    			config.WithDataBindMount("C:\\Temp\\AzureStorage");
    		else 
    			config.WithDataBindMount("/tmp/AzureStorage");
    	});
    }
    
    builder.AddContainer("storage-explorer", "sebagomez/azurestorageexplorer")
    	.WithHttpEndpoint(targetPort: 8080);
    
    	// .WithEnvironment("AZURE_STORAGE_CONNECTIONSTRING", $"""
    
    	// Use the Azurite AccountName and Key:
    
    	// 	DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
    	// 	AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
    
    
    	// 	BlobEndpoint={blobs.Resource.ConnectionStringExpression}/devstoreaccount1;
    	// 	""");
  7. davidfowl commented on Apr 18, 2024

    @davidfowl
    Collaborator
    var builder = DistributedApplication.CreateBuilder(args);
    
    
    var storage = builder.AddAzureStorage("storage")
                         .RunAsEmulator(config => config.WithDataVolume())
                         .AddBlobs("blobs");
    
    builder.AddContainer("storage-explorer", "sebagomez/azurestorageexplorer")
        .WithHttpEndpoint(targetPort: 8080)
        .WithEnvironment(e =>
        {
            e.EnvironmentVariables["AZURE_STORAGE_CONNECTIONSTRING"] = new ConnectionStringReference(storage.Resource, optional: false);
        })
        .ExcludeFromManifest();
    
    builder.Build().Run();

    RunAsEmulator will be used in run mode and not publish mode, so no need to guard it behind the IsDevelopment method.
    I also swapped from using a bind mount (which needs a host volume) to using a volume (https://docs.docker.com/storage/bind-mounts/). Our azure storage resource only exposes connection strings for specific resources like blob, queue or table. We don't expose the uber connection string since with all 3.

    I also added ExcludeFromManifest to remove this container from being deployed assuming that's what you want to do.

    When you call WithReference, this is what happens under the covers (we make a ConnectionStringReference). There's an API coming post GA that will make this a bit easier:

  8. csharpfritz commented on Apr 18, 2024

    @csharpfritz
    Author

    Very cool! That appears to have that container running and connecting to the storage service. I really need to access the tables browser, so I changed the connectionstring over to the tables instance and it doesn't appear to be connecting like the blobs connectionstring does.

    There appears to be a few issues with the Storage Explorer container. I'll connect with that package owner and see if we can get that in a better working order

    Huge thanks for the help with this solution!

  9. 19essibusa commented on Aug 7, 2024

    @19essibusa

    Hi please is this solution for the azure storage explorer going to eventually be officially integrated to .NET aspire as a container like pgAdmin? That would be so helpful if possible. I am having issues connecting the Microsoft azure monitor to the azurite instance created by aspire.

  10. NiklasEi commented on Sep 3, 2024

    @NiklasEi

    Configuring the storage explorer like shown above doesn't seem to work as expected for me. The explorer fails to log me in using the supplied connection string. Did someone get this to work for a local Azurite blob storage?

    On the first glance, it looks like an issue on the side of storage explorer, not Aspire, so I opened sebagomez/azurestorageexplorer#173 with more details.

    Edit: this seems to be a general connectivity issue from Aspire on Linux without Docker Desktop.

  11. added
    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
    and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Sep 3, 2024
  12. added
    area-integrationsIssues pertaining to Aspire Integrations packages
    azureIssues associated specifically with scenarios tied to using Azure
    and removed
    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
    on Sep 7, 2024
  13. swissarmykirpan commented on Sep 24, 2024

    @swissarmykirpan

    Our azure storage resource only exposes connection strings for specific resources like blob, queue or table. We don't expose the uber connection string since with all 3.

    David Fowler (@davidfowl) it would be useful to get this uber connection string. Happy to contribute.

  14. swissarmykirpan commented on Sep 24, 2024

    @swissarmykirpan

    Jeffrey T. Fritz (@csharpfritz) another alternative may be change the Azure Storage Resource Endpoints (in the resources table) to use Azure Storage Explorer Direct Links https://learn.microsoft.com/en-us/azure/storage/common/storage-explorer-direct-link

  15. davidfowl commented on Oct 16, 2024

    @davidfowl
    Collaborator

    Filed an issue #6234.

    Closing this as there's no locally hostable storage explorer that we would embed by default.

  16. locked and limited conversation to collaborators on Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-integrationsIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using Azureazure-storageIssues related to azure storage integration

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions