小编Aka*_*mal的帖子

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

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

未找到资源组“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 都是正确的。

azure azure-powershell azure-sql-database az

3
推荐指数
1
解决办法
1596
查看次数

标签 统计

az ×1

azure ×1

azure-powershell ×1

azure-sql-database ×1