未找到资源组下的资源 (SQL Server)

Aka*_*mal 3 azure azure-powershell azure-sql-database az

当我尝试在弹性池中获取数据库时出现错误:

未找到资源组“rg_name”下的资源“Microsoft.Sql/servers/dbserver.database.windows.net/databases/db_name”。

但是对于其他数据库服务器和资源组,此脚本有效。

我正在尝试的脚本:

Import-Module Az.Accounts
Import-Module Az.Sql

#Connect-AzAccount -SubscriptionId $subscriptionId
$passwd = ConvertTo-SecureString <PASSWORD> -AsPlainText -Force
$pscredential = New-Object System.Management.Automation.PSCredential('<Application ID>/<Service Principle ID>', $passwd)
Connect-AzAccount -ServicePrincipal -Credential $pscredential -Tenant $tenantId 
#-SubscriptionId $subscriptionId

$rg = Get-AzResourceGroup -Name $resourceGroupName

Set-AzSqlDatabase -DatabaseName $DatabaseName -ElasticPoolName $PoolName -ResourceGroupName $rg.ResourceGroupName -ServerName $serverName 

Read-Host -Prompt "Press Enter to exit "
Run Code Online (Sandbox Code Playgroud)

我验证了权限、资源及其名称/ID 都是正确的。

Ama*_*SFT 8

根据错误消息,我可以看到您提供的-ServerNamedbserver.database.windows.net

请提供-ServerNameas onlydbserver而不是dbserver.database.windows.net