1

我正在尝试运行此命令

Set-AzSqlDatabaseAudit `
>> -ResourceGroupName "" `
>> -ServerName "" `
>> -DatabaseName "" `
>> -BlobStorageTargetState Enabled `
>> -StorageAccountResourceId "?"

要在 SQL 数据库上设置审计,但我无法找到一种方法来获取我已经为此目的创建的存储容器的资源 ID。我在 GUI 中看不到此属性,也不知道如何通过 CLI 检索它。

有没有一些通用的方法来获取一个对象的资源 id 或者我在哪里可以找到它?

4

1 回答 1

2

Set-AzSqlDatabaseAudit您使用的命令是azure Powershell,而不是azure CLI,因此如果您想通过 Powershell 获取StorageAccountResourceId,只需使用以下命令。

(Get-AzStorageAccount -ResourceGroupName <group-name> -Name <storageaccount-name>).Id

在此处输入图像描述

如果您想使用 azure CLI,只需使用az storage account show,这id就是您想要的。

az storage account show --resource-group 'xxxxx' --name 'xxxxx'

在此处输入图像描述

于 2021-03-26T01:32:13.367 回答