Skip to content

Commit cef659f

Browse files
authored
Update uninstall in solution-office-365.md
Uninstall script didn't work cause AcquireToken became async. I updated the script to call AcquireTokenAsync.
1 parent 82468e7 commit cef659f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

articles/azure-monitor/insights/solution-office-365.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ To enable the administrative account for the first time, you must provide admini
197197
198198
The last step is to subscribe the application to your Log Analytics workspace. You also do this with a PowerShell script.
199199
200-
The last step is to subscribe the application to your Log Analytics workspace. You also do this with a PowerShell script.
201-
202200
1. Save the following script as *office365_subscription.ps1*.
203201
204202
```powershell
@@ -457,15 +455,17 @@ You can remove the Office 365 management solution using the process in [Remove a
457455
# Create Authentication Context tied to Azure AD Tenant
458456
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
459457
# Acquire token
460-
$global:authResultARM = $authContext.AcquireToken($resourceAppIdURIARM, $clientId, $redirectUri, "Auto")
461-
$authHeader = $global:authResultARM.CreateAuthorizationHeader()
458+
$platformParameters = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformParameters" -ArgumentList "Auto"
459+
$global:authResultARM = $authContext.AcquireTokenAsync($resourceAppIdURIARM, $clientId, $redirectUri, $platformParameters)
460+
$global:authResultARM.Wait()
461+
$authHeader = $global:authResultARM.Result.CreateAuthorizationHeader()
462462
$authHeader
463463
}
464464
465465
Function Office-UnSubscribe-Call{
466466
467467
#----------------------------------------------------------------------------------------------------------------------------------------------
468-
$authHeader = $global:authResultARM.CreateAuthorizationHeader()
468+
$authHeader = $global:authResultARM.Result.CreateAuthorizationHeader()
469469
$ResourceName = "https://manage.office.com"
470470
$SubscriptionId = $Subscription[0].Subscription.Id
471471
$OfficeAPIUrl = $ARMResource + 'subscriptions/' + $SubscriptionId + '/resourceGroups/' + $ResourceGroupName + '/providers/Microsoft.OperationalInsights/workspaces/' + $WorkspaceName + '/datasources/office365datasources_' + $SubscriptionId + $OfficeTennantId + '?api-version=2015-11-01-preview'
@@ -503,6 +503,8 @@ You can remove the Office 365 management solution using the process in [Remove a
503503
.\office365_unsubscribe.ps1 -WorkspaceName MyWorkspace -ResourceGroupName MyResourceGroup -SubscriptionId '60b79d74-f4e4-4867-b631-yyyyyyyyyyyy' -OfficeTennantID 'ce4464f8-a172-4dcf-b675-xxxxxxxxxxxx'
504504
```
505505
506+
You will be prompted for credentials. Provide the credentials for your Log Analytics workspace.
507+
506508
## Data collection
507509
508510
### Supported agents

0 commit comments

Comments
 (0)