mgpmul
mgpmul

Reputation: 175

How to fix AZ CLI error "The Resource '..' under resource group '..' was not found"?

I am struggling to execute az cli commands related to resource groups. I have set the correct subscription. I can list the resource group with the command 'az group list'. But I get errors when referring to the resource group in a command where mysql is involved, for example:

C:>az mysql server show --resource-group HHDevelopment --name hh-dev-test
The Resource 'Microsoft.DBforMySQL/servers/hh-dev-test' under resource group 'HHDevelopment' was not found.

When I login to Azure portal, I can access the mysql server and the databases without any problem. What should I do to get it working on the Azure Command Line Interface?

When I ask for a list databases in the resource group, I get a json formatted list of alert rules, components and databases. So, the group and the database exists. An example from the list is the following:

C:> az resource list --resource-group HHDevelopment`

`[...]
  {
    "id": "/subscriptions/0c839bc3-c0c3-470b-a62f-c4998fe000c0/resourceGroups/HHDevelopment/providers/Microsoft.Sql/servers/hh-dev-test/databases/Elp.Arrangement.10",
    "identity": null,
    "kind": "v12.0,user",
    "location": "westeurope",
    "managedBy": null,
    "name": "hh-dev-test/Elp.Arrangement.10",
    "plan": null,
    "properties": null,
    "resourceGroup": "HHDevelopment",
    "sku": {
      "capacity": 5,
      "family": null,
      "model": null,
      "name": "Basic",
      "size": null,
      "tier": "Basic"
    },
    "tags": null,
    "type": "Microsoft.Sql/servers/databases"
  },
[...]

Upvotes: 1

Views: 2499

Answers (1)

4c74356b41
4c74356b41

Reputation: 72191

why do you think it exists? you show that it finds some sql server in that resource group, whilst your command is looking for mysql server, i just you just mistakenly try to get sql server resource using command for mysql server

I suppose you are looking for these: https://learn.microsoft.com/en-us/cli/azure/sql/server?view=azure-cli-latest

Upvotes: 1

Related Questions