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'