Skip to content

Commit cb64700

Browse files
authored
Merge pull request #121581 from bdegs/patch-18
Update azure-monitor-agent-windows-client.md
2 parents 13a29f5 + 5b090ad commit cb64700

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

articles/azure-monitor/agents/azure-monitor-agent-windows-client.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,17 @@ DELETE https://management.azure.com/providers/Microsoft.Insights/monitoredObject
291291
```PowerShell
292292
$TenantID = "xxxxxxxxx-xxxx-xxx" #Your Tenant ID
293293
$SubscriptionID = "xxxxxx-xxxx-xxxxx" #Your Subscription ID
294-
$ResourceGroup = "rg-yourResourseGroup" #Your resroucegroup
294+
$ResourceGroup = "rg-yourResourceGroup" #Your resourcegroup
295295
296-
Connect-AzAccount -Tenant $TenantID
296+
#If cmdlet below produces an error stating 'Interactive authentication is not supported in this session, please run cmdlet 'Connect-AzAccount -UseDeviceAuthentication
297+
#uncomment next to -UseDeviceAuthentication below
298+
Connect-AzAccount -Tenant $TenantID #-UseDeviceAuthentication
297299
298300
#Select the subscription
299301
Select-AzSubscription -SubscriptionId $SubscriptionID
300302
301303
#Grant Access to User at root scope "/"
302-
$user = Get-AzADUser -UserPrincipalName (Get-AzContext).Account
304+
$user = Get-AzADUser -SignedIn
303305
304306
New-AzRoleAssignment -Scope '/' -RoleDefinitionName 'Owner' -ObjectId $user.Id
305307
@@ -336,7 +338,7 @@ Invoke-RestMethod -Uri $requestURL -Headers $AuthenticationHeader -Method PUT -B
336338
#2. Create a monitored object
337339
338340
# "location" property value under the "body" section should be the Azure region where the MO object would be stored. It should be the "same region" where you created the Data Collection Rule. This is the location of the region from where agent communications would happen.
339-
$Location = "eastus" #Use your own loacation
341+
$Location = "eastus" #Use your own location
340342
$requestURL = "https://management.azure.com/providers/Microsoft.Insights/monitoredObjects/$TenantID`?api-version=2021-09-01-preview"
341343
$body = @"
342344
{
@@ -368,8 +370,9 @@ $body = @"
368370
369371
Invoke-RestMethod -Uri $requestURL -Headers $AuthenticationHeader -Method PUT -Body $body
370372
371-
#(Optional example). Associate another DCR to monitored object
373+
#(Optional example). Associate another DCR to monitored object. Remove comments around text below to use.
372374
#See reference documentation https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-rule-associations/create?tabs=HTTP
375+
<#
373376
$associationName = "assoc02" #You must change the association name to a unique name, if you want to associate multiple DCR to monitored object
374377
$DCRName = "dcr-PAW-WindowsClientOS" #Your Data collection rule name
375378
@@ -388,7 +391,7 @@ Invoke-RestMethod -Uri $requestURL -Headers $AuthenticationHeader -Method PUT -B
388391
#4. (Optional) Get all the associatation.
389392
$requestURL = "https://management.azure.com$RespondId/providers/microsoft.insights/datacollectionruleassociations?api-version=2021-09-01-preview"
390393
(Invoke-RestMethod -Uri $requestURL -Headers $AuthenticationHeader -Method get).value
391-
394+
#>
392395
393396
```
394397
## Verify successful setup

0 commit comments

Comments
 (0)