Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redeployment shouldn't remove manually assigned identities #2730

Closed
WhitWaldo opened this issue Mar 8, 2024 · 3 comments
Closed

Redeployment shouldn't remove manually assigned identities #2730

WhitWaldo opened this issue Mar 8, 2024 · 3 comments
Labels
area-deployment azure Issues associated specifically with scenarios tied to using Azure

Comments

@WhitWaldo
Copy link
Contributor

I've got an existing Key Vault and managed user-assigned identity with the appropriate roles for accessing it. After deploying the container app via azd up, I assigned the UAI to it and everything worked as expected.

An hour later after I'd made a few more changes and re-deployed via azd up, I realized the app wasn't working. I dug into the logs and realized that as part of the redeployment, even though the other resources remained unchanged, the container app no longer listed my already-existing UAI (in addition to the one deployed by Aspire).

I sort of expected that re-deployments of container apps would kick off new revision deployments instead of deleting and deploying an entirely new container app, meaning that any changes I'd make to the app would persist, so please consider this a feature request - if I add my own identities to a deployed resource, updates to the deployment should start from whatever is already there and be additive for whatever it's trying to do rather than replace with a clean resource.

Thanks!

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 8, 2024
@davidfowl
Copy link
Member

davidfowl commented Mar 8, 2024

This is because you now have 2 sources of truth. Azd has no idea about the changes you manually made to the environment and using azd up (which does azd provision) will not keep those changes. There's currently no support for customizing the compute outside of generating the bicep using azd infra synth, this is still being worked on.

Changes to the environment outside of the app model or IaC will be overwritten when re-provisioning. azd is optimized for being able to repeatably create environments with infrastructure.

Running azd deploy will only deploy your compute and leave the infrastructure alone.

@WhitWaldo
Copy link
Contributor Author

Typically, if you download an ARM template and re-apply it and nothing has changed, nothing happens. If you download the template and make a change to it, it only applies whatever has changed (except some of the older resources - looking at you vnets). And of course, if you deploy a brand new template, you get brand new resources.

But I guess I would expect some sort of guardrail up that prevents developers from inadvertently deploying a destructive template. The deployments appear to be idempotent - I might suggest adding a validation step: if there already exists a resource group matching the target deployment and it's filled with the same resource names as have been generated in the newly-prepared local template, throw on the brakes and have the developer confirm that they want to proceed with the operation (and accept a -F to force it through without the check).

Otherwise, I can easily see this being a source of great frustration that especially when the template supports references to existing resources, an inadvertent redeployment obliterating the roles on an existing Key Vault or dropping the relationship between an environment its App Insights instance because azd isn't aware of it.

@davidfowl
Copy link
Member

Can you move this to https://github.com/Azure/azure-dev/issues?

@davidfowl davidfowl added area-deployment azure Issues associated specifically with scenarios tied to using Azure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 8, 2024
@davidfowl davidfowl added the bug label Sep 15, 2024
@davidfowl davidfowl closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-deployment azure Issues associated specifically with scenarios tied to using Azure
Projects
None yet
Development

No branches or pull requests

3 participants