【问题标题】:Azure CLI - How to get ResourceId of an storage container?Azure CLI - 如何获取存储容器的 ResourceId?
【发布时间】:2021-06-22 18:05:42
【问题描述】:

我正在尝试运行此命令

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

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

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

【问题讨论】:

    标签: azure-cli resource-id


    【解决方案1】:

    您使用的命令Set-AzSqlDatabaseAuditazure Powershell,而不是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'
    

    【讨论】:

      猜你喜欢
      • 2011-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-05
      • 2021-12-06
      • 1970-01-01
      • 1970-01-01
      • 2020-09-15
      相关资源
      最近更新 更多