Skip to content

Commit 8cc19d8

Browse files
Merge pull request #213992 from yossi-y/patch-5
Correction to BYOS PowerShell cmdlet
2 parents e488307 + 4097a55 commit 8cc19d8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

articles/azure-monitor/logs/customer-managed-keys.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ N/A
279279
# [Azure CLI](#tab/azure-cli)
280280

281281
```azurecli
282+
az account set —subscription "storage-account-subscription-id"
283+
282284
$storageAccountId = '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage name>'
283285
284286
az account set —subscription "workspace-subscription-id"
@@ -289,11 +291,13 @@ az monitor log-analytics workspace linked-storage create —type Query —resour
289291
# [PowerShell](#tab/powershell)
290292

291293
```powershell
292-
$storageAccount.Id = Get-AzStorageAccount -ResourceGroupName "resource-group-name" -Name "storage-account-name"
294+
Select-AzSubscription "StorageAccount-subscription-id"
295+
296+
$storageAccountId = (Get-AzStorageAccount -ResourceGroupName "resource-group-name" -Name "storage-account-name").id
293297
294298
Select-AzSubscription "workspace-subscription-id"
295299
296-
New-AzOperationalInsightsLinkedStorageAccount -ResourceGroupName "resource-group-name" -WorkspaceName "workspace-name" -DataSourceType Query -StorageAccountIds $storageAccount.Id
300+
New-AzOperationalInsightsLinkedStorageAccount -ResourceGroupName "resource-group-name" -WorkspaceName "workspace-name" -DataSourceType Query -StorageAccountIds $storageAccountId
297301
```
298302

299303
# [REST](#tab/rest)
@@ -329,6 +333,8 @@ N/A
329333
# [Azure CLI](#tab/azure-cli)
330334

331335
```azurecli
336+
az account set —subscription "storage-account-subscription-id"
337+
332338
$storageAccountId = '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage name>'
333339
334340
az account set —subscription "workspace-subscription-id"
@@ -339,11 +345,13 @@ az monitor log-analytics workspace linked-storage create —type ALerts —resou
339345
# [PowerShell](#tab/powershell)
340346

341347
```powershell
342-
$storageAccount.Id = Get-AzStorageAccount -ResourceGroupName "resource-group-name" -Name "storage-account-name"
348+
Select-AzSubscription "StorageAccount-subscription-id"
349+
350+
$storageAccountId = (Get-AzStorageAccount -ResourceGroupName "resource-group-name" -Name "storage-account-name").id
343351
344352
Select-AzSubscription "workspace-subscription-id"
345353
346-
New-AzOperationalInsightsLinkedStorageAccount -ResourceGroupName "resource-group-name" -WorkspaceName "workspace-name" -DataSourceType Alerts -StorageAccountIds $storageAccount.Id
354+
New-AzOperationalInsightsLinkedStorageAccount -ResourceGroupName "resource-group-name" -WorkspaceName "workspace-name" -DataSourceType Alerts -StorageAccountIds $storageAccountId
347355
```
348356

349357
# [REST](#tab/rest)

0 commit comments

Comments
 (0)