Skip to content

Randomly generated passwords for resources like Redis should be consistent to the resource name and environment #8894

Open
@mip1983

Description

@mip1983

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a few separate visual studio solutions splitting out aspects of my app e.g. front end customer facing, back end management etc. They all target the same resource group and container apps environment, deploying together into the same eco-system sharing resources like databases, cache, service bus etc.

I have been deploying these resources through a 'uber infrastructure solution', that adds the disparate projects in under one AppHost, which is ok, but it's another project and it ends up coupling the projects in such a way that they end up needing to be updated together to matching nuget packages etc.

So looking to get away from the central uber infrastructure solution, deploying them as separate solutions using the AppHost from each solution, still targeting the same resource group and container apps environment.

With Aspire 9.2, I've by and large been able to do this, I can set the name of the container apps environment and Azure resources in my apphost with an 'InfrastructureResolver', so that despite being in separate solutions, the Azure container environment resources resolve to the same resource (there is a core resources library that the different solutions reference so that they are configured consistently).

I have hit a problem with some resource types though, like Redis Cache for example, where it generates a random password for that resource. I can deploy one solution, it works fine, but when I deploy another targeting the same resource, it changes to another random password so the thing I deployed previous can no longer talk to Redis. I suspect I'm going to hit this with other resources as well, I can see 'serviceBus-sql-pwd' being generated and 'OtlpApiKey' for example.

While I've eventually figured out how to work around the problem with Redis by manually specifying a password, I think it would make sense if the behavior whenever Aspire needs to generate a random password for a resource, that it's a deterministic in what it generates, e.g. the password is a function of the resource name, the resource group and subscription id, in order to support different Aspire solutions targeting shared resources.

Expected Behavior

Any passwords generated for resources are consistent to the resource name and environment.

Steps To Reproduce

Create two separate Aspire solutions targeting the same Azure subscription/resource group. Add redis cache to both. Use 'AddAzureContainerAppEnvironment' and 'ConfigureInfrastructure' to ensure both projects are targeting the same container apps environment.

Deploy each in turn and monitor a resources that connects with the cache in the console. After the deployment of the second solution, the first will start complaining about the redis cache connection with a password error.

Exceptions (if any)

No response

.NET Version info

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-integrationsIssues pertaining to Aspire Integrations packages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions