Get-AzureRmSqlDatabase does not return tags
When a database has tags defined, the preview cmdlet Get-AzureRmSqlDatabase does not return any tags.
release-1.0.0-preview
What is the status of this issue?
Fixed in #3206
Could you tell me which release this made it into? It doesn't seem to be working in 3.3.0.
@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
@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 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?
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?
Any update on when this will be fixed? Or a decent work around?
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