Azure / Azure/azure-cli

`az resource show -t Microsoft.Sql/servers/databases` not recognized

Open
#15,896 1 comment 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

I'm writing a script to retrieve the resource id from my SQL database. However - `az resource show` does recognize the database type.

Using the ID found in the portal JSON view of the resource I do:

```
az resource show --id [removed]/providers/Microsoft.Sql/servers/filetrnsfrm-dbsrv-dev/databases/filetrnsfrm-db-dev
```
Which returns

```
{
"id": "/subscriptions/[removed]/providers/Microsoft.Sql/servers/filetrnsfrm-dbsrv-dev/databases/filetrnsfrm-db-dev",
"identity": null,
"kind": "v12.0,user,vcore,serverless",
"location": "West Europe",
"managedBy": null,
"name": "filetrnsfrm-db-dev",
"plan": null,
"properties": {
...
"status": "Online",
"zoneRedundant": false
},
"resourceGroup": "ms-csu-nl-jvw-filetrnsfrm-dev",
"sku": null,
"tags": null,
"type": "Microsoft.Sql/servers/databases"
}
```
Now, using the exact resource-group, name and type as provided in the previous:
```
az resource show -g ms-csu-nl-jvw-filetrnsfrm-dev -n filetrnsfrm-db-dev --resource-type Microsoft.Sql/servers/databases
```
Gives
```
ResourceNotFoundError: The Resource 'Microsoft.Sql/servers/filetrnsfrm-db-dev' under resource group 'ms-csu-nl-jvw-filetrnsfrm-dev' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
```
So 'databases' seems to be nested under 'servers' - and in the error message it appears to me as if it's looking for servers named filetranfrm-db-dev as opposed to a database with that name.
However, I couldn't find anything in the [docs](https://docs.microsoft.com/en-us/cli/azure/resource?view=azure-cli-latest#az_resource_show) what I need to differently, unless it's the `--parent` parameter ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.