Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
395 stars 190 forks source link

[Issue] Can't run azd down on RG with OpenAI instance #4210

Closed pamelafox closed 8 hours ago

pamelafox commented 1 month ago

Output from azd version azd version 1.10.0-beta.1-pr.4028794 (commit 1388546c9db82c93a53b8ba8335962b2b68fd408)

Describe the bug

I do not think this is an issue with azd itself, but y'all might know where to reroute or have workarounds.

When running "azd down" on https://github.com/Azure-Samples/openai-chat-vision-quickstart/, I get this error:

--------------------------------------------------------------------------------
RESPONSE 409: 409 Conflict
ERROR CODE: ResourceGroupDeletionBlocked
--------------------------------------------------------------------------------
{
  "error": {
    "code": "ResourceGroupDeletionBlocked",
    "message": "Deletion of resource group 'chatvision-rg' failed as resources with identifiers 'Microsoft.CognitiveServices/accounts/edmqlohrlcibo-cog' could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is '50cc42c7afb813d4bff8d3974397e4d9'. Please check audit logs for more details.",
    "details": [
      {
        "target": "/subscriptions/32ea8a26-5b40-4838-b6cb-be5c89a57c16/resourceGroups/chatvision-rg/providers/Microsoft.CognitiveServices/accounts/edmqlohrlcibo-cog",
        "message": "{\"error\":{\"code\":\"CannotDeleteAccountWithDeployments\",\"message\":\"Could not delete account since it contains 1 deployment(s). Please delete deployments first and try again.\"}}"
      }
    ]
  }
}

I see a similar warning in the Portal:

Screenshot 2024-08-13 at 5 31 24 AM

I'm not sure if this is only happening because the deployment uses a Global SKU or if its now happening for all OpenAI accounts. I've only had it reported for this repo so far, but perhaps its a recent change.

rajeshkamal5050 commented 1 month ago

@vhvb1989 @hemarina do we handle deleting deployments for other resources as part of azd down?

vhvb1989 commented 1 month ago

@vhvb1989 @hemarina do we handle deleting deployments for other resources as part of azd down?

No. Azd deletes resource groups directly w/o looking what's in them. I've started a conversation with @achandmsft to follow

wbreza commented 3 weeks ago

@rajeshkamal5050 - this may be handled by deployment stacks when the deployment is created as part of the deployment stack. I will test on our feature branch and report back.

If the deployments are created outside of azd it isn't cut & dry whether or not azd should delete deployments on behalf of user or not.

UPDATE Confirmed! - When AI model deployments are created within an Azure Deployment stack they will then be properly deleted during azd down without any additional changes.

image
rajeshkamal5050 commented 1 week ago

@pamelafox starting azd 1.10.0 we have added support for deployment stacks(alpha feature azd config set alpha.deployment.stacks on) which should handle it without need for the hooks https://github.com/Azure-Samples/openai-chat-vision-quickstart/pull/10

Can you give it a try and let us know if it works? cc: @wbreza

microsoft-github-policy-service[bot] commented 1 week ago

Hi @pamelafox. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

pamelafox commented 1 week ago

@rajeshkamal5050 At what point will it not require the alpha flag?

microsoft-github-policy-service[bot] commented 8 hours ago

Hi @pamelafox, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.