I just started using Azure. I'm using containers. For each container, I gave a dns-name-label property. Then after few hours of Azure training, I dicided to delete all my containers. Any resource still exist.
I cannot create a new container using a dns-name-label which has been deleted.
The DNS name label 'xxx' in container group 'x' not available. Try using a different label.
I would prefer find a solution rather than change all my dns-name-label because I have an existing software configuration (really long) which is using all these dns-name-label.
Would someone have a solution please ?
I already tried few commands like az cache list or az cache purge.
The error shows that the DNS name still exists. Probably, it has not completely finished deleting the container group or the current DNS name is in use in another container group somewhere.
I can not reproduce your issue. You should use az container delete --name MyContainerGroup --resource-group MyResourceGroup to remove that container group then create your new container with the old DNS name.
Related
I recently created inside one of my resource groups an Azure Container App (with an environment & the rest) just for learning reasons (at the West Europe region). After I played with that, I decided to delete it. I tried to delete it without any success from the portal.
Looking around in the portal I found out that a new resource group had been created with name MC_braverock-518cbd83-rg_braverock-518cbd83_westeurope. This resource group was never generated by me. It appears that inside it there are a public IP address, a NSG & 2 Kubernetes Load Balancers.
I tried then to delete that auto-generated (somehow) resource group but again with no success. I literarily can't even touch it. I tried to delete all resources one by one. Nothing again. I even issued the command az group delete --resource-group "MC_braverock-518cbd83-rg_braverock-518cbd83_westeurope" from inside the Azure Cloud Shell and it seems that the cli gets stuck in Running.... When I had issued the command from the portal it was still running for a whole hour. So, obviously something is going wrong.
I visited the page https://resources.azure.com/, then I visited that resource group and the Json in the resource group that returned is having the following:
"provisioningState": "Deleting".
Do you know how I can delete the resources & the resource group?
I am almost confident that this is not being deleted... :(
EDIT:
Trying to delete manually one of the Load Balancers in that resource group I get a message that the Load Balancer in that subscription can not be deleted as it is in use by a virtual machine scale set that it is on a totally different subscription (a subscription that I am not aware off).
To delete the resources and the resource group, you can try using Resource Explorer (azure.com) portal as there might be some dependencies to delete the resource group/resources.
You can try deleting the resources like below:
Go to Resource Explorer (azure.com) portal -> Click on your subscription -> Expand Resource groups -> Select your Resource Group
Expand Providers -> Microsoft.Network -> networkSecurityGroups -> Select your NSG -> Action(POST,DELETE) -> Delete
In my environment testnsg networkSecurityGroup deleted successfully in the Azure Portal.
You can try deleting the required Azure Resources by following the same process. If still, you are not able to delete the Azure resource Group try checking the child resources associated to that resource group.
I tried to reproduce the same in my environment and got the same error like below:
az network lb delete -g ResourceGroupName -n LoadBalancerName
The error "LoadBalancerUseByVirtualMachineScaleSet" usually occurs if backendpool is being used by any other resource.
To resolve the error, try executing below commands in CloudShell like below:
Delete the load balancer associated with the VMSS:
az vmss update --resource-group ResourceGroupName1 --name VmssName --remove virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].loadBalancerBackendAddressPools 0
Update the VMSS instance:
az vmss update-instances --instance-ids "*" -n VmssName -g ResourceGroupName1
Now, delete load balancer and it will be deleted successfully like below:
az network lb delete -g ResourceGroupName -n LoadBalancerName
Reference:
Update or delete an existing load balancer used by virtual machine scale sets - Azure Load Balancer
This is a side artifact of Container app managedEnvironment resource. You need to first delete the environment in order to get artifacts to get automatically removed.
As JJ mentioned, the MC_* resource group is created when you create ACAs with the internal configuration. You try to find whether you have any container app environments in your subscription. Could be that you created your test app in a wrong resource group and can't find it now. :)
Try deleting all container app envs this resource group will automatically be gone.
After running a DevOps pipeline that created several resources, only two (a new resource group and a Functions app) show up in Azure CLI using az ... list --subscription ....
Other resources, like Static Web Apps and a SQL Server don't show up in that list or when running az staticwebapp list --subscription ... or az sql server list --subscription ... with the subscription argument specified. I have confirmed that these resources DO show up in the portal, and my account is listed as an owner (inherited from subscription) for them in the portal.
I have deployed Azure Static WebApp using Azure Devops.
Followed this MSDoc to publish the static web app.
By using,
az staticwebapp list --resource-group YourRGName
and
az staticwebapp list --subscription YourSubscriptionID
,Iam able to get the StaticWeb App list
For anyone else running into this:
I have not found a solution to getting the az staticwebapp list command to work for my use case, as the results that show up immediately after creating a resource are just inconsistent. However, as a workaround that should satisfy most use cases, using this API (using az rest command) to find all resources associated with the group created by the pipeline, then filtering those down to find the Static Web App I want, seems to work.
Then, when using other APIs that reference that app before it shows up in the normal list, fully specifying subscription and resource group alongside the app's name seems to make things more reliable too.
As far as I can tell, this is probably just a limitation with the inconsistency of how long information about newly deployed resources takes to propagate that shows up when trying to find a resource immediately after creating it.
I have an azure container instance running in a vnet within a subnet.
I have been (until now) able to update the image of this container instance with a command like this one:
az container create \
--resource-group my_rg\
--name containername \
--image containerregistry.azurecr.io/myimage:latest \
--registry-login-server containerregistry.azurecr.io \
--registry-username username \
--registry-password password \
--vnet my_vnet \
--subnet my_subnet
Until now, when I needed to update the image in my container, I would build it, push it to my container registry in azure, and run this command.
The container would stop and restart with the new image.
It may not be the issue but I upgraded my azure cli recently, I am now on version 2.34.1.
When I run this command now I get this message:
(NetworkProfileCannotChange) The network profile of existing container group 'containername' cannot be changed. To change a network profile, you must delete and then create the container group with the changed property.
Code: NetworkProfileCannotChange
I don't want to change my network profile, I just want to update the image.
I have seen it with
az network profile list --resource-group my_rg
It looks fine for me.
I have double checked, my vnet and my subnet have not changed.
I don't understand why this command does not work anymore.
Any idea of what's happening ?
Cheers
Tested in my enviroment it is working fine for me with both the version.
Earlier i was using the AZ CLI version 2.32.0 able to create the Container.
Now i have updated the AZ CLI version to 2.34.1 and trying to change or update the image of container using the same command with same existing VNET and Subnet
Getting Simmillar Kind of Error when i am changing the Subnet name.
Suggestion 1 : Would suggest you to recheck if your existing container is not taking another subnet or VNET when you are creating container with updated images.
Suggestion 2 : Sometimes it might stopes you to update the Image on Running and exist conatainer, you get this error: "If you are going to update the os type, restart policy, network profile, CPU, memory or GPU resources for a container group, you must delete it first and then create a new one"
Suggestion 3 : TO avoid the recreation of conatainer scheduled container instance that is running once a day. Whenever it starts it is pulling the docker image with the :latest tag from the azure container registry. This avoids re-creation of the container group.
For more information You can refer this https://circleci.com/blog/azure-custom-images/ and Related Issue
Background
A year or two ago, when I was learning Azure, I created a container registry (ACR).
I would now like to use that exact same name again. I can either use that same registry, or I would like to delete that registry and start again. (It does not have anything useful on it that I do not have in other locations.)
But I cannot seem to figure out which subscription / resource group owns that registry. I am nearly certain I know which one it was, but when I log on to that account, the registry is not there. To be clear, I tried to create it again but it said that the name was not available. It's a very weird name, so I am pretty sure it is still my old one sitting around somewhere.
Question
How can I find out the owner of a container registry?
In my case, it is a dumb mistake. But I have to imagine that companies will want a particular name, and even be willing to pay a little to have a particular registry name. Is there no way to query Azure to ask for the owner of a container registry? What happens if I lost the "paperwork" for which subscription owns it, like in my case?
I was hoping for something like az acr public show or something like that.
I was hoping for something like az acr public show or something like
that
There is a CLI command like it:
az acr show --name acr_name
You can get all the information about your ACR, int includes the owner resource group and its resource Id. The resource Id will show you the subscription ID.
But when you use the CLI, it means you already login and uses the default subscription or set the current subscription. If you don't know which subscription the ACR in, you need to try this command in all the subscriptions your account has.
And for the owner of the ACR, you need to list all the assignment and filter with your requirements:
az role assignment list --role Owner --scope acr_resourceId
This CLI command can list all the owners directly to your ACR, but the list does not include the owners that inherit from the subscription.
I'm attempting to list all Databases from a CosmosDB instances using the AZ command line -
az account set --subscription $subscriptionId
az cosmosdb database list --name $cosmosName --resource-group $resourceGroup
The above command is resulting the following response -
Operation Failed: Resource Not Found
When adding the --debug argument I'm presented with the above error as well as the below detail -
Status code: 404
{"code":"NotFound","message":"Entity with the specified id does not exist in the system.\r\nActivityId: d5383919-7c23-4158-bded-2c623d55ab9b, Microsoft.Azure.Documents.Common/2.0.0.0"}
The CosmosDB that I am attempting to query absolutely does exist, derived by running the command az cosmosdb list, and I copied the SubscriptionId and ResourceGroup directly from the portal.
The MS docs and the command az cosmosdb database list --help both seem to suggest what I'm doing should work.
Can anyone suggest what I could do to fix the issue?
This error can happen if the PC where you are running Azure CLI doesn't have network connectivity to the CosmosDB account. To verify if this is the problem, please go to Portal.Azure.com > CosmosDB account > Firewall and Virtual Networks and if the firewall is enabled, add your current IP address.
I had same problem today, and I found firewall is the problem, adding client public IP will fix it, but there is another tricky part, it will take some time even after the firewall rule is updated in Azure portal ( for me I think it's 5~ 10 minutes ). I guess the rule need to be deployed to different location and it take longer time depending on which region you hit.
So you probably just need to be a bit more patient after updated firewall rule.
Also be aware, az allow three different options:
(1) resource group name and account name
(2) account name and key
(3) url-connection and key
I have found only 1 and 3 work, (2) will give me a error:
unsupported operand type(s) for +: 'NoneType' and 'str'
both "az cosmosdb database show" and "az cosmosdb database list" have same issue. the version I am using is azure-cli (2.0.45).