AzureRM.Sql
模块版本
4.7.0-preview
.
我想将弹性池中许多数据库的PITR保留策略设置为35天。默认情况下,vCore池的保留策略为7天,这是不够的。我有数百个数据库,所以需要用PowerShell设置它们。
如果我得到要更新的数据库列表
Get-AzureRmSqlElasticPoolDatabase
Set-AzureRmSqlDatabaseBackupShortTermRetentionPolicy
运行后者时出现以下错误:
import-module : The following error occurred while loading the extended type data file: Error in TypeData "Microsoft.Azure.Commands.Sql.Replication.Model.AzureSqlDatabaseCopyModel": The member DefaultDisplayPropertySet is already present.
Error in TypeData "Microsoft.Azure.Commands.Sql.Replication.Model.AzureReplicationLinkModel": The member DefaultDisplayPropertySet is already present.
At line:1 char:1
+ import-module azurerm.sql
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
我试过的东西
我已尝试导入所需版本的模块,并使用第一个命令获取数据库列表,但出现以下错误:
Get-AzureRmSqlElasticPoolDatabase : The 'Get-AzureRmSqlElasticPoolDatabase' command was found in the module 'AzureRM.Sql', but the module could not be loaded. For more information, run 'Import-Module AzureRM.Sql'.
At line:1 char:8
+ $dbs = Get-AzureRmSqlElasticPoolDatabase -ElasticPoolName $settings.E ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureRmSqlElasticPoolDatabase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
如果我导入AzureRm模块
import-module azurerm.sql
我得到这个错误:
导入模块:加载扩展类型数据文件时发生以下错误:TypeData“Microsoft.Azure.Commands.Sql.Replication.Model.AzureSqlDatabaseCopyModel”中出错:成员DefaultDisplayPropertySet已存在。
在line:1 char:1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+类别信息:InvalidOperation:(:)[Import Module],RuntimeException
+FullyQualifiedErrorId:FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
模块
Get-Module AzureRm -ListAvailable | select Name, Version
Name Version
---- -------
AzureRM 6.10.0
Get-Module AzureRm.Sql -ListAvailable | select Name, Version
:
Name Version
---- -------
AzureRM.Sql 4.11.5
AzureRM.Sql 4.7.0
AzureRM.Sql 4.4.0
$PSVersionTable
:
Name Value
---- -----
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
有什么办法让它工作吗?