azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzureRmSqlDatabase does not return tags

Open OliverMartini opened this issue 11 years ago • 9 comments

When a database has tags defined, the preview cmdlet Get-AzureRmSqlDatabase does not return any tags.

release-1.0.0-preview

OliverMartini avatar Oct 19 '15 09:10 OliverMartini

What is the status of this issue?

OliverMartini avatar Jun 22 '16 07:06 OliverMartini

Fixed in #3206

jamestao avatar Nov 17 '16 20:11 jamestao

Could you tell me which release this made it into? It doesn't seem to be working in 3.3.0.

jnyiri avatar Jun 28 '17 19:06 jnyiri

@jnyiri Currently retrieving tags on a database is only supported when requesting a specific database. Listing all databases in a server won't return the tags.

PS C:\Users\adamkr> Get-AzureRmSqlDatabase adamkr adamkr -DatabaseName tdb1


ResourceGroupName             : adamkr
ServerName                    : adamkr
DatabaseName                  : tdb1
Location                      : Canada East
DatabaseId                    : 2dd766e1-9b3d-4fd8-aacc-7423a55e56f9
Edition                       : Standard
CollationName                 : SQL_Latin1_General_CP1_CI_AS
CatalogCollation              :
MaxSizeBytes                  : 268435456000
Status                        : Online
CreationDate                  : 6/28/2017 23:01:03
CurrentServiceObjectiveId     : f1173c43-91bd-4aaa-973c-54e79e15235b
CurrentServiceObjectiveName   : S0
RequestedServiceObjectiveId   : f1173c43-91bd-4aaa-973c-54e79e15235b
RequestedServiceObjectiveName :
ElasticPoolName               :
EarliestRestoreDate           : 6/28/2017 23:11:24
Tags                          : {[t1, t1_val], [t2, t2_val]}
ResourceId                    : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/adamkr/providers/Microsoft.Sql/servers/adamkr/databases/tdb1
CreateMode                    :
ReadScale                     : Disabled

akromm-zz avatar Jun 28 '17 23:06 akromm-zz

@jnyiri @jamestao Any news on a fix for this? It's still an issue for me in v 4.2.0 of the AzureRM.SQL module.

sbgillett avatar Feb 13 '18 12:02 sbgillett

@sbgillett can you provide more details about what problem you are having?

  • What command are you running?
  • What is the output you are getting?
  • What output are you expecting to get?

akromm-zz avatar Feb 13 '18 17:02 akromm-zz

I get an identical result to yours; tags aren't returned by Get-AzureRmSqlDatabase unless requesting a specific database. Is this by design, and if so, why?

sbgillett avatar Feb 14 '18 10:02 sbgillett

Any update on when this will be fixed? Or a decent work around?

joezuchora avatar Feb 20 '18 16:02 joezuchora

We have several api-versions of each API. In this case, the database cmdlets are using the api-version 2014-04-01. We have fixed this tags issue in the service in a new api-version, but due to the complexity of the database API it has taken us some time to finalize this new api-version and fully adopt it in client-side tools such as PowerShell. (The complexity comes from the fact that database API has so many modes: create, copy, point in time restore, deleted db restore, geo restore, ...). The good news is that we are actually nearly done on the server-side work, and will be made available in powershell in the next couple months.

You can workaround this for now by using Get-AzureRmResource to specifically use the new 2017-03-01-preview api version which has this bug fixed.

> (Get-AzureRmResource -ResourceId /subscriptions/f28872d6-4a93-4bb1-84b9-aecb02b6af4c/resourceGroups/cli/providers/Microsoft.Sql/servers/jaredmoocli/databases -ApiVersion 2014-04-01).tags
(empty response)
> (Get-AzureRmResource -ResourceId /subscriptions/f28872d6-4a93-4bb1-84b9-aecb02b6af4c/resourceGroups/cli/providers/Microsoft.Sql/servers/jaredmoocli/databases -ApiVersion 2017-03-01-preview).tags
Name                           Value
----                           -----
hello                          world
awesome                        yes

jaredmoo avatar Feb 20 '18 18:02 jaredmoo