使用 AzurePowershell 全局检查 Azure SQL 服务器名称是否存在
Globally check for existence of Azure SQL Server name with AzurePowershell
我正在尝试解决此错误消息
New-AzureRmSqlServer : 45120: The name 'server.database.windows.net' already exists. Choose a different name.
我可以检查资源组中是否存在 SQL 服务器名称,但不确定如何进行全局检查。是的,我可以选择一个不同的名称 - 但如果它也存在,我会遇到同样的错误。
有什么方法可以用 'Try Catch' 捕获错误并做些什么吗??在此先感谢您的任何建议。
只需创建一个 do while 循环 ;)
do {
$continue = $null
New-AzureRmSqlServer ... -ErrorVariable continue -ErrorAction SilentlyContinue
# Create another name here
} while ($continue)
我正在尝试解决此错误消息
New-AzureRmSqlServer : 45120: The name 'server.database.windows.net' already exists. Choose a different name.
我可以检查资源组中是否存在 SQL 服务器名称,但不确定如何进行全局检查。是的,我可以选择一个不同的名称 - 但如果它也存在,我会遇到同样的错误。
有什么方法可以用 'Try Catch' 捕获错误并做些什么吗??在此先感谢您的任何建议。
只需创建一个 do while 循环 ;)
do {
$continue = $null
New-AzureRmSqlServer ... -ErrorVariable continue -ErrorAction SilentlyContinue
# Create another name here
} while ($continue)