Open bmda opened 9 months ago
It seems there is a builder resource under the container app environment You can use the following command to list the builder resource and remove it.
az resource list --namespace Microsoft.App --resource-type builders
az rest --method delete --url <builder-resource-id>?api-version=2023-08-01-preview
Thanks both. On top of what @howang-ms mentioned, I confirm that we are pushing an improvement of the API so that this builder gets automatically deleted whenever the Container App Environment is. The change is ready to be merged and will be part of the next deployment payload.
Excellent. Thankyou both.
Is there an update on this?
I can list the builders using:
az resource list --namespace Microsoft.App --resource-type builders
but then it fails when issuing:
az rest --method delete --url <builder-resource-id>?api-version=2023-08-01-preview
With a "no matches found" error.
What should be the api-version
to use?
Hi @mauroservienti. The delete command didn't work for me either until I realised I have to escape the question mark. So this should work:
az rest --method delete --url <builder-resource-id>\?api-version=2023-08-01-preview
Thanks, @bmda. Unfortunately I had no luck. By escaping the api-version
I get no errors but the builder is not deleted anyway.
Thanks both. On top of what @howang-ms mentioned, I confirm that we are pushing an improvement of the API so that this builder gets automatically deleted whenever the Container App Environment is. The change is ready to be merged and will be part of the next deployment payload.
@daniv-msft It seems this is not yet merged, or doesn't work as expected. I'm still getting the error when deleting an (empty) Container Environment in the Azure Portal:
az rest --method delete --url
?api-version=2023-08-01-preview
Looks like this is still an issue. I am getting the same error message.
Sorry to hear that deleting the environment is still creating issues! @simonjj, @harryli0108 > Could one of you please redirect to the person in charge of the builders related code as I moved to another team?
The commands mentioned above worked for me. One thing to consider is that the deletion of the builder takes a few minutes so you should wait a bit before trying to delete the environment.
You can also monitor the outcome of the operation from the "Activity Log" in the Azure portal (bell icon -> "more events").
If anyone needs more detailed steps, here's what Azure support gave me:
The builder is a different resource from the app container. When this happens, you must first remove the builder and then remove the app environment container. To check if you have a pending builder, list the resources associated with your environment with the following command:
az resource list --namespace Microsoft.App --resource-type builders
You will probably receive a response with a resource like Microsoft.App/builders. To remove it, run the following command replacing
with the builder id that you found in the query: az rest --method delete --url
?api-version=2023-08-01-preview The command will run in the background. Repeat the query until the builder resource stops returning. When the return is empty, proceed with deleting the app environment container:
az containerapp env delete -n MyContainerappEnvironment -g MyResourceGroup
And now you should be able to delete without any problems via command line or the portal. Be patient, as this command takes time to complete.
If you use the zsh
shell remember to escape the ?
or add quotes around the --url
parameter value.
For me, installing the containerapp
extension, the Microsoft.App
, and the Microsoft.OperationalInsights
providers solved the deletion issue:
az extension add --name containerapp --upgrade
az provider register --namespace Microsoft.App
az provider register --namespace Microsoft.OperationalInsights
And then the deletion is working:
az containerapp env delete -n <container_app_env> -g <resource_group>
This issue is a:
Issue description
az containerapp env delete -g <resource group> -n <container apps env>
fails with(ManagedEnvironmentHasBuilders) The specified environment <container apps env> cannot be deleted because it still contains 1 Builders.
Additional context
Attempting to delete via the portal also fails with a similar error message.