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

Set-AzureRmSqlDatabase -Tags --> does not work, throws error

Open OliverMartini opened this issue 10 years ago • 2 comments

When issuing the cmdlet Set-AzureRmSqlDatabase -Tags an error is thrown. The cmdlet should accept the Tags hashtable received from Get-AzureRmResource cmdlet.

Steps to reproduce:

  1. Get AzureRm Resource $resource = Get-AzureRmResource -ResourceId YOUR_SqlDatabase_ResourceId
  2. Call Set-AzureRmSqlDatabase cmdlet to set Tags on database resource.
Set-AzureRmSqlDatabase -DatabaseName SqlDatabase Name `
    -ServerName SqlDatabaseServer -ResourceGroupName ResourceGroupName `
    -Tags $resource.Tags
  1. Following error is thrown
Set-AzureRmSqlDatabase : Cannot convert 'System.Collections.Generic.List`1[System.Collections.Hashtable]' to the type
'System.Collections.Generic.Dictionary`2[System.String,System.String]' required by parameter 'Tags'. Specified method
is not supported.
At line:1 char:106
+ ... erverName SqlDatabaseServer -ResourceGroupName ResourceGroupName -Tags $resource.Tags
+                                                            ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-AzureRmSqlDatabase], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Azure.Commands.Sql.Database.Cmdlet.SetAzureSqlDatabase

OliverMartini avatar Jun 22 '16 07:06 OliverMartini

@akromm can you take a look?

markcowl avatar Jun 22 '16 20:06 markcowl

Fixed Tags overall in #3206

jamestao avatar Nov 17 '16 20:11 jamestao