@@ -12,7 +12,7 @@ ms.workload: tbd
12
12
ms.tgt_pltfrm : na
13
13
ms.devlang : na
14
14
ms.topic : article
15
- ms.date : 07/05 /2018
15
+ ms.date : 08/15 /2018
16
16
ms.author : bwren
17
17
18
18
---
@@ -118,23 +118,18 @@ To enable the administrative account for the first time, you must provide admini
118
118
)
119
119
120
120
$option = [System.StringSplitOptions]::RemoveEmptyEntries
121
-
121
+
122
122
IF ($Subscription -eq $null)
123
- {Login-AzureRmAccount -ErrorAction Stop}
123
+ {Login-AzureRmAccount -ErrorAction Stop}
124
124
$Subscription = (Select-AzureRmSubscription -SubscriptionId $($SubscriptionId) -ErrorAction Stop)
125
125
$Subscription
126
126
$Workspace = (Set-AzureRMOperationalInsightsWorkspace -Name $($WorkspaceName) -ResourceGroupName $($ResourceGroupName) -ErrorAction Stop)
127
127
$WorkspaceLocation= $Workspace.Location
128
- $WorkspaceLocationShort= $Workspace.PortalUrl.Split("/",$option)[1].Split(".",$option)[0]
129
128
$WorkspaceLocation
130
129
131
130
Function AdminConsent{
132
131
133
132
$domain='login.microsoftonline.com'
134
- $mmsDomain = 'login.mms.microsoft.com'
135
- $WorkspaceLocationShort= $Workspace.PortalUrl.Split("/",$option)[1].Split(".",$option)[0]
136
- $WorkspaceLocationShort
137
- $WorkspaceLocation
138
133
switch ($WorkspaceLocation.Replace(" ","").ToLower()) {
139
134
"eastus" {$OfficeAppClientId="d7eb65b0-8167-4b5d-b371-719a2e5e30cc"; break}
140
135
"westeurope" {$OfficeAppClientId="c9005da2-023d-40f1-a17a-2b7d91af4ede"; break}
@@ -148,16 +143,13 @@ To enable the administrative account for the first time, you must provide admini
148
143
"eastus2" {$OfficeAppClientId="7eb65b0-8167-4b5d-b371-719a2e5e30cc"; break}
149
144
"westus2" {$OfficeAppClientId="98a2a546-84b4-49c0-88b8-11b011dc8c4e"; break} #Need to check
150
145
"usgovvirginia" {$OfficeAppClientId="c8b41a87-f8c5-4d10-98a4-f8c11c3933fe";
151
- $domain='login.microsoftonline.us';
152
- $mmsDomain = 'usbn1.login.oms.microsoft.us'; break} # US Gov Virginia
146
+ $domain='login.microsoftonline.us'; break}
153
147
default {$OfficeAppClientId="55b65fb5-b825-43b5-8972-c8b6875867c1";
154
148
$domain='login.windows-ppe.net'; break} #Int
155
149
}
156
150
157
- $OfficeAppRedirectUrl="https://$($WorkspaceLocationShort).$($mmsDomain)/Office365/Authorize"
158
- $OfficeAppRedirectUrl
159
151
$domain
160
- Start-Process -FilePath "https://$($domain)/common/adminconsent?client_id=$($OfficeAppClientId)&state=12345&redirect_uri=$($OfficeAppRedirectUrl) "
152
+ Start-Process -FilePath "https://$($domain)/common/adminconsent?client_id=$($OfficeAppClientId)&state=12345"
161
153
}
162
154
163
155
AdminConsent -ErrorAction Stop
@@ -195,7 +187,7 @@ The last step is to subscribe the application to your Log Analytics workspace. Y
195
187
$line='#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
196
188
$line
197
189
IF ($Subscription -eq $null)
198
- {Login-AzureRmAccount -ErrorAction Stop}
190
+ {Login-AzureRmAccount -ErrorAction Stop}
199
191
$Subscription = (Select-AzureRmSubscription -SubscriptionId $($SubscriptionId) -ErrorAction Stop)
200
192
$Subscription
201
193
$option = [System.StringSplitOptions]::RemoveEmptyEntries
@@ -227,12 +219,6 @@ The last step is to subscribe the application to your Log Analytics workspace. Y
227
219
228
220
Function RESTAPI-Auth {
229
221
230
- # Load ADAL Azure AD Authentication Library Assemblies
231
- $adal = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
232
- $adalforms = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
233
- $null = [System.Reflection.Assembly]::LoadFrom($adal)
234
- $null = [System.Reflection.Assembly]::LoadFrom($adalforms)
235
-
236
222
$global:SubscriptionID = $Subscription.SubscriptionId
237
223
# Set Resource URI to Azure Service Management API
238
224
$resourceAppIdURIARM=$ARMResource;
@@ -360,7 +346,7 @@ The last step is to subscribe the application to your Log Analytics workspace. Y
360
346
.\office365_subscription.ps1 -WorkspaceName MyWorkspace -ResourceGroupName MyResourceGroup -SubscriptionId '60b79d74-f4e4-4867-b631-yyyyyyyyyyyy' -OfficeUsername '[email protected] ' -OfficeTennantID 'ce4464f8-a172-4dcf-b675-xxxxxxxxxxxx' -OfficeClientId 'f8f14c50-5438-4c51-8956-zzzzzzzzzzzz' -OfficeClientSecret 'y5Lrwthu6n5QgLOWlqhvKqtVUZXX0exrA2KRHmtHgQb='
361
347
```
362
348
363
- ### Troublshooting
349
+ ### Troubleshooting
364
350
365
351
You may see the following error if you attempt to create a subscription after the subscription already exists.
366
352
@@ -401,7 +387,7 @@ You can remove the Office 365 management solution using the process in [Remove a
401
387
402
388
$line
403
389
IF ($Subscription -eq $null)
404
- {Login-AzureRmAccount -ErrorAction Stop}
390
+ {Login-AzureRmAccount -ErrorAction Stop}
405
391
$Subscription = (Select-AzureRmSubscription -SubscriptionId $($SubscriptionId) -ErrorAction Stop)
406
392
$Subscription
407
393
$option = [System.StringSplitOptions]::RemoveEmptyEntries
@@ -432,12 +418,6 @@ You can remove the Office 365 management solution using the process in [Remove a
432
418
433
419
Function RESTAPI-Auth {
434
420
435
- # Load ADAL Azure AD Authentication Library Assemblies
436
- $adal = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
437
- $adalforms = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
438
- $null = [System.Reflection.Assembly]::LoadFrom($adal)
439
- $null = [System.Reflection.Assembly]::LoadFrom($adalforms)
440
-
441
421
$global:SubscriptionID = $Subscription.SubscriptionId
442
422
# Set Resource URI to Azure Service Management API
443
423
$resourceAppIdURIARM=$ARMResource;
0 commit comments