Skip to content
Discussion options

You must be logged in to vote

We ended up changing to this

    /// <summary>
    /// Adds Azure Storage with a unique name to allow multiple environments in the same subscription. https://github.com/dotnet/aspire/discussions/12652
    /// </summary>
    public static IResourceBuilder<AzureStorageResource> AddAzureStorageWithUniqueName(
        this IDistributedApplicationBuilder builder,
        string name
    )
    {
#pragma warning disable CA1308 // Azure Storage account names must be lowercase
        var sanitizedName = System.Text.RegularExpressions.Regex.Replace(name, "[^a-zA-Z0-9]", "").ToLowerInvariant();
#pragma warning restore CA1308

        var storagePrefix = sanitizedName.Length > 11 ? sanitizedName[..11] 

Replies: 1 comment 13 replies

Comment options

You must be logged in to vote
13 replies
@vhvb1989
Comment options

vhvb1989 Nov 7, 2025
Collaborator

@mitchdenny
Comment options

@parched
Comment options

@parched
Comment options

Answer selected by parched
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants