279
279
# [ Azure CLI] ( #tab/azure-cli )
280
280
281
281
``` azurecli
282
+ az account set —subscription "storage-account-subscription-id"
283
+
282
284
$storageAccountId = '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage name>'
283
285
284
286
az account set —subscription "workspace-subscription-id"
@@ -289,11 +291,13 @@ az monitor log-analytics workspace linked-storage create —type Query —resour
289
291
# [ PowerShell] ( #tab/powershell )
290
292
291
293
``` 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
293
297
294
298
Select-AzSubscription "workspace-subscription-id"
295
299
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
297
301
```
298
302
299
303
# [ REST] ( #tab/rest )
329
333
# [ Azure CLI] ( #tab/azure-cli )
330
334
331
335
``` azurecli
336
+ az account set —subscription "storage-account-subscription-id"
337
+
332
338
$storageAccountId = '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage name>'
333
339
334
340
az account set —subscription "workspace-subscription-id"
@@ -339,11 +345,13 @@ az monitor log-analytics workspace linked-storage create —type ALerts —resou
339
345
# [ PowerShell] ( #tab/powershell )
340
346
341
347
``` 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
343
351
344
352
Select-AzSubscription "workspace-subscription-id"
345
353
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
347
355
```
348
356
349
357
# [ REST] ( #tab/rest )
0 commit comments