Skip to content

Commit 5be2915

Browse files
committed
Updates
1 parent c46d35b commit 5be2915

File tree

4 files changed

+8
-44
lines changed

4 files changed

+8
-44
lines changed

articles/key-vault/general/howto-logging.md

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ You can create a new Log Analytics workspace using one of these methods:
5252
- [Create a Log Analytics workspace using Azure PowerShell](../../azure-monitor/logs/quick-create-workspace.md?tabs=azure-powershell)
5353
- [Create a Log Analytics workspace the Azure portal](../../azure-monitor/logs/quick-create-workspace.md?tabs=azure-portal)
5454

55-
56-
5755
## Connect to your Key Vault subscription
5856

5957
The first step in setting up key logging is connecting to the subscription containing your key vault. This is especially important if you have multiple subscriptions associated with your account.
@@ -74,41 +72,11 @@ Get-AzSubscription
7472
Set-AzContext -SubscriptionId "<subscriptionID>"
7573
```
7674

77-
## Create a storage account for your logs
78-
79-
Although you can use an existing storage account for your logs, here you create a new storage account dedicated to Key Vault logs.
80-
81-
For additional ease of management, you'll also use the same resource group as the one that contains the key vault. In the [Azure CLI quickstart](quick-create-cli.md) and [Azure PowerShell quickstart](quick-create-powershell.md), this resource group is named **myResourceGroup**, and the location is *eastus*. Replace these values with your own, as applicable.
82-
83-
You also need to provide a storage account name. Storage account names must be unique, between 3 and 24 characters in length, and use numbers and lowercase letters only. Lastly, you create a storage account of the `Standard_LRS` SKU.
84-
85-
With the Azure CLI, use the [az storage account create](/cli/azure/storage/account#az-storage-account-create) command.
86-
87-
```azurecli-interactive
88-
az storage account create --name "<your-unique-storage-account-name>" -g "myResourceGroup" --sku "Standard_LRS"
89-
```
90-
91-
With Azure PowerShell, use the [New-AzStorageAccount](/powershell/module/az.storage/new-azstorageaccount) cmdlet. You will need to provide the location that corresponds to the resource group.
75+
## Obtain resource IDs
9276

93-
```powershell
94-
New-AzStorageAccount -ResourceGroupName myResourceGroup -Name "<your-unique-storage-account-name>" -Type "Standard_LRS" -Location "eastus"
95-
```
96-
97-
In either case, note the ID of the storage account. The Azure CLI operation returns the ID in the output. To obtain the ID with Azure PowerShell, use [Get-AzStorageAccount](/powershell/module/az.storage/get-azstorageaccount), and assign the output to the variable `$sa`. You can then see the storage account with `$sa.id`. (The `$sa.Context` property is also used later in this article.)
98-
99-
```powershell-interactive
100-
$sa = Get-AzStorageAccount -Name "<your-unique-storage-account-name>" -ResourceGroup "myResourceGroup"
101-
$sa.id
102-
```
103-
104-
The ID of the storage account is in the following format: "/subscriptions/*your-subscription-ID*/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/*your-unique-storage-account-name*".
105-
106-
> [!NOTE]
107-
> If you decide to use an existing storage account, it must use the same subscription as your key vault. It must use the Azure Resource Manager deployment model, rather than the classic deployment model.
77+
To enable logging on a key vault, you will need the resource ID of the key vault, as well as the destination (Azure Storage or Log Analytics account).
10878

109-
## Obtain your key vault resource ID
110-
111-
In the [CLI quickstart](quick-create-cli.md) and [PowerShell quickstart](quick-create-powershell.md), you created a key with a unique name. Use that name again in the following steps. If you can't remember the name of your key vault, you can use the Azure CLI [az keyvault list](/cli/azure/keyvault#az-keyvault-list) command, or the Azure PowerShell [Get-AzKeyVault](/powershell/module/az.keyvault/get-azkeyvault) cmdlet, to list them.
79+
If you can't remember the name of your key vault, you can use the Azure CLI [az keyvault list](/cli/azure/keyvault#az-keyvault-list) command, or the Azure PowerShell [Get-AzKeyVault](/powershell/module/az.keyvault/get-azkeyvault) cmdlet, to find it.
11280

11381
Use the name of your key vault to find its resource ID. With the Azure CLI, use the [az keyvault show](/cli/azure/keyvault#az-keyvault-show) command.
11482

@@ -166,23 +134,19 @@ Set-AzDiagnosticSetting "<key-vault-resource-id>" -StorageAccountId $sa.id -Enab
166134

167135
To configure diagnostic settings in the Azure portal, follow these steps:
168136

169-
1. From the **Resource** pane menu, select **Diagnostic settings**.
137+
1. From the **Resource** pane menu, select **Diagnostic settings**, and then **Add diagnostic setting**
170138

171139
:::image type="content" source="../media/diagnostics-portal-1.png" alt-text="Screenshot that shows how to select diagnostic settings.":::
172140

173-
1. Select **+ Add diagnostic setting**.
174-
175-
:::image type="content" source="../media/diagnostics-portal-2.png" alt-text="Screenshot that shows adding a diagnostic setting.":::
176-
177-
1. Select a name for your diagnostic setting. To configure logging for Azure Monitor for Key Vault, select **AuditEvent** and **Send to Log Analytics workspace**. Then choose the subscription and Log Analytics workspace to which you want to send your logs. You can also select the option to **Archive to a storage account**.
141+
1. Under **Category groups**, select both **audit** and **allLogs**.
142+
1. If Azure Log Analytics is the destination, select **Send to Log Analytics workspace** and choose your subscription and workspace from the drop-down menus. You may also select **Archive to a storage account** and choose your subscription and storage account from the drop-down menus.
178143

179-
:::image type="content" source="../media/diagnostics-portal-3.png" alt-text="Screenshot of diagnostic settings options.":::
144+
:::image type="content" source="../media/diagnostics-portal-2.png" alt-text="Screenshot of diagnostic settings options.":::
180145

181-
Otherwise, select the options that pertain to the logs that you want to select.
182146

183147
1. When you have selected your desired options, select **Save**.
184148

185-
:::image type="content" source="../media/diagnostics-portal-4.png" alt-text="Screenshot that shows how to save the options you selected.":::
149+
:::image type="content" source="../media/diagnostics-portal-3.png" alt-text="Screenshot that shows how to save the options you selected.":::
186150

187151
---
188152

35.8 KB
Loading
-141 KB
Loading
-189 KB
Loading

0 commit comments

Comments
 (0)