Azure CLI - 如何获取存储容器的 ResourceId?

Azure CLI - How to get ResourceId of an storage container?

我正在尝试运行这个命令

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

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

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

您正在使用的命令 Set-AzSqlDatabaseAuditazure Powershell, not azure CLI,所以如果您想要 Powershell 获取 StorageAccountResourceId,只需使用下面的命令。

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

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

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