简体   繁体   中英

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

I am trying to run this command

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

To setup auditing on SQL database but I am not able to find a way how to get resource id of storage container I already created for this purpose. I don't see this property in the GUI and also I don't know how to retrieve it via CLI.

Is there some general way how to get resource id of an object or where do I find it?

The command Set-AzSqlDatabaseAudit you are using is azure Powershell , not azure CLI , so if you want to Powershell to get the StorageAccountResourceId , just use the command below.

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

在此处输入图像描述

If you want to use azure CLI, just use az storage account show , the id is what you want.

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

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM