Skip to content

Commit c90098e

Browse files
committed
sync
1 parent 338056c commit c90098e

8 files changed

Lines changed: 42 additions & 516 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,7 @@ dist
105105

106106
# NPM lock file
107107
package-lock.json
108-
/.vs
108+
109+
# VS Code cache
110+
.vscode/
111+

1-Authentication/1-sign-in/AppCreationScripts/Cleanup.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ Function Cleanup
5959
# Removes the applications
6060
Write-Host "Cleaning-up applications from tenant '$tenantName'"
6161

62-
Write-Host "Removing 'webApp' (ExpressWebApp-1) if needed"
63-
Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-1'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
64-
$apps = Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-1'"
62+
Write-Host "Removing 'webApp' (ExpressWebApp-c1s1) if needed"
63+
Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-c1s1'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
64+
$apps = Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-c1s1'"
6565
if ($apps)
6666
{
6767
Remove-AzureADApplication -ObjectId $apps.ObjectId
@@ -70,10 +70,10 @@ Function Cleanup
7070
foreach ($app in $apps)
7171
{
7272
Remove-AzureADApplication -ObjectId $app.ObjectId
73-
Write-Host "Removed ExpressWebApp-1.."
73+
Write-Host "Removed ExpressWebApp-c1s1.."
7474
}
7575
# also remove service principals of this app
76-
Get-AzureADServicePrincipal -filter "DisplayName eq 'ExpressWebApp-1'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
76+
Get-AzureADServicePrincipal -filter "DisplayName eq 'ExpressWebApp-c1s1'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
7777

7878
}
7979

1-Authentication/1-sign-in/AppCreationScripts/Configure.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ Function ConfigureApplications
137137
$user = Get-AzureADUser -ObjectId $creds.Account.Id
138138

139139
# Create the webApp AAD application
140-
Write-Host "Creating the AAD application (ExpressWebApp-1)"
140+
Write-Host "Creating the AAD application (ExpressWebApp-c1s1)"
141141
# Get a 2 years application key for the webApp Application
142142
$pw = ComputePassword
143143
$fromDate = [DateTime]::Now;
144144
$key = CreateAppKey -fromDate $fromDate -durationInYears 2 -pw $pw
145145
$webAppAppKey = $pw
146146
# create the application
147-
$webAppAadApplication = New-AzureADApplication -DisplayName "ExpressWebApp-1" `
147+
$webAppAadApplication = New-AzureADApplication -DisplayName "ExpressWebApp-c1s1" `
148148
-HomePage "http://localhost:4000" `
149149
-ReplyUrls "http://localhost:4000/redirect" `
150-
-IdentifierUris "https://$tenantName/ExpressWebApp-1" `
150+
-IdentifierUris "https://$tenantName/ExpressWebApp-c1s1" `
151151
-PasswordCredentials $key `
152152
-PublicClient $False
153153

@@ -164,12 +164,12 @@ Function ConfigureApplications
164164
}
165165

166166

167-
Write-Host "Done creating the webApp application (ExpressWebApp-1)"
167+
Write-Host "Done creating the webApp application (ExpressWebApp-c1s1)"
168168

169169
# URL of the AAD application in the Azure portal
170170
# Future? $webAppPortalUrl = "https://portal.azure.com/#@"+$tenantName+"/blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/"+$webAppAadApplication.AppId+"/objectId/"+$webAppAadApplication.ObjectId+"/isMSAApp/"
171171
$webAppPortalUrl = "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/"+$webAppAadApplication.AppId+"/objectId/"+$webAppAadApplication.ObjectId+"/isMSAApp/"
172-
Add-Content -Value "<tr><td>webApp</td><td>$currentAppId</td><td><a href='$webAppPortalUrl'>ExpressWebApp-1</a></td></tr>" -Path createdApps.html
172+
Add-Content -Value "<tr><td>webApp</td><td>$currentAppId</td><td><a href='$webAppPortalUrl'>ExpressWebApp-c1s1</a></td></tr>" -Path createdApps.html
173173

174174

175175
# Update config file for 'webApp'

2-Authorization-I/1-call-graph/AppCreationScripts/Cleanup.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ Function Cleanup
5959
# Removes the applications
6060
Write-Host "Cleaning-up applications from tenant '$tenantName'"
6161

62-
Write-Host "Removing 'webApp' (ExpressWebApp-2) if needed"
63-
Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-2'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
64-
$apps = Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-2'"
62+
Write-Host "Removing 'Client' (ExpressWebApp-c2s1) if needed"
63+
Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-c2s1'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
64+
$apps = Get-AzureADApplication -Filter "DisplayName eq 'ExpressWebApp-c2s1'"
6565
if ($apps)
6666
{
6767
Remove-AzureADApplication -ObjectId $apps.ObjectId
@@ -70,10 +70,10 @@ Function Cleanup
7070
foreach ($app in $apps)
7171
{
7272
Remove-AzureADApplication -ObjectId $app.ObjectId
73-
Write-Host "Removed ExpressWebApp-2.."
73+
Write-Host "Removed ExpressWebApp-c2s1.."
7474
}
7575
# also remove service principals of this app
76-
Get-AzureADServicePrincipal -filter "DisplayName eq 'ExpressWebApp-2'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
76+
Get-AzureADServicePrincipal -filter "DisplayName eq 'ExpressWebApp-c2s1'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
7777

7878
}
7979

2-Authorization-I/1-call-graph/AppCreationScripts/Configure.ps1

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -191,65 +191,65 @@ Function ConfigureApplications
191191
# Get the user running the script to add the user as the app owner
192192
$user = Get-AzureADUser -ObjectId $creds.Account.Id
193193

194-
# Create the webApp AAD application
195-
Write-Host "Creating the AAD application (ExpressWebApp-2)"
196-
# Get a 2 years application key for the webApp Application
194+
# Create the Client AAD application
195+
Write-Host "Creating the AAD application (ExpressWebApp-c2s1)"
196+
# Get a 2 years application key for the Client Application
197197
$pw = ComputePassword
198198
$fromDate = [DateTime]::Now;
199199
$key = CreateAppKey -fromDate $fromDate -durationInYears 2 -pw $pw
200-
$webAppAppKey = $pw
200+
$ClientAppKey = $pw
201201
# create the application
202-
$webAppAadApplication = New-AzureADApplication -DisplayName "ExpressWebApp-2" `
202+
$ClientAadApplication = New-AzureADApplication -DisplayName "ExpressWebApp-c2s1" `
203203
-HomePage "http://localhost:4000/" `
204204
-ReplyUrls "http://localhost:4000/redirect" `
205-
-IdentifierUris "https://$tenantName/ExpressWebApp-2" `
205+
-IdentifierUris "https://$tenantName/ExpressWebApp-c2s1" `
206206
-PasswordCredentials $key `
207207
-PublicClient $False
208208

209209
# create the service principal of the newly created application
210-
$currentAppId = $webAppAadApplication.AppId
211-
$webAppServicePrincipal = New-AzureADServicePrincipal -AppId $currentAppId -Tags {WindowsAzureActiveDirectoryIntegratedApp}
210+
$currentAppId = $ClientAadApplication.AppId
211+
$ClientServicePrincipal = New-AzureADServicePrincipal -AppId $currentAppId -Tags {WindowsAzureActiveDirectoryIntegratedApp}
212212

213213
# add the user running the script as an app owner if needed
214-
$owner = Get-AzureADApplicationOwner -ObjectId $webAppAadApplication.ObjectId
214+
$owner = Get-AzureADApplicationOwner -ObjectId $ClientAadApplication.ObjectId
215215
if ($owner -eq $null)
216216
{
217-
Add-AzureADApplicationOwner -ObjectId $webAppAadApplication.ObjectId -RefObjectId $user.ObjectId
218-
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($webAppServicePrincipal.DisplayName)'"
217+
Add-AzureADApplicationOwner -ObjectId $ClientAadApplication.ObjectId -RefObjectId $user.ObjectId
218+
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($ClientServicePrincipal.DisplayName)'"
219219
}
220220

221221

222-
Write-Host "Done creating the webApp application (ExpressWebApp-2)"
222+
Write-Host "Done creating the Client application (ExpressWebApp-c2s1)"
223223

224224
# URL of the AAD application in the Azure portal
225-
# Future? $webAppPortalUrl = "https://portal.azure.com/#@"+$tenantName+"/blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/"+$webAppAadApplication.AppId+"/objectId/"+$webAppAadApplication.ObjectId+"/isMSAApp/"
226-
$webAppPortalUrl = "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/"+$webAppAadApplication.AppId+"/objectId/"+$webAppAadApplication.ObjectId+"/isMSAApp/"
227-
Add-Content -Value "<tr><td>webApp</td><td>$currentAppId</td><td><a href='$webAppPortalUrl'>ExpressWebApp-2</a></td></tr>" -Path createdApps.html
225+
# Future? $ClientPortalUrl = "https://portal.azure.com/#@"+$tenantName+"/blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/"+$ClientAadApplication.AppId+"/objectId/"+$ClientAadApplication.ObjectId+"/isMSAApp/"
226+
$ClientPortalUrl = "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/"+$ClientAadApplication.AppId+"/objectId/"+$ClientAadApplication.ObjectId+"/isMSAApp/"
227+
Add-Content -Value "<tr><td>Client</td><td>$currentAppId</td><td><a href='$ClientPortalUrl'>ExpressWebApp-c2s1</a></td></tr>" -Path createdApps.html
228228

229229
$requiredResourcesAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]
230230

231-
# Add Required Resources Access (from 'webApp' to 'Microsoft Graph')
232-
Write-Host "Getting access from 'webApp' to 'Microsoft Graph'"
231+
# Add Required Resources Access (from 'Client' to 'Microsoft Graph')
232+
Write-Host "Getting access from 'Client' to 'Microsoft Graph'"
233233
$requiredPermissions = GetRequiredPermissions -applicationDisplayName "Microsoft Graph" `
234234
-requiredDelegatedPermissions "User.Read" `
235235

236236
$requiredResourcesAccess.Add($requiredPermissions)
237237

238-
# Add Required Resources Access (from 'webApp' to 'Windows Azure Service Management API')
239-
Write-Host "Getting access from 'webApp' to 'Windows Azure Service Management API'"
238+
# Add Required Resources Access (from 'Client' to 'Windows Azure Service Management API')
239+
Write-Host "Getting access from 'Client' to 'Windows Azure Service Management API'"
240240
$requiredPermissions = GetRequiredPermissions -applicationDisplayName "Windows Azure Service Management API" `
241241
-requiredDelegatedPermissions "user_impersonation" `
242242

243243
$requiredResourcesAccess.Add($requiredPermissions)
244244

245245

246-
Set-AzureADApplication -ObjectId $webAppAadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess
246+
Set-AzureADApplication -ObjectId $ClientAadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess
247247
Write-Host "Granted permissions."
248248

249-
# Update config file for 'webApp'
249+
# Update config file for 'Client'
250250
$configFile = $pwd.Path + "\..\auth.json"
251251
Write-Host "Updating the sample code ($configFile)"
252-
$dictionary = @{ "clientId" = $webAppAadApplication.AppId;"tenantId" = $tenantId;"clientSecret" = $webAppAppKey;"redirectUri" = $webAppAadApplication.ReplyUrls;"postLogoutRedirectUri" = $webAppAadApplication.HomePage };
252+
$dictionary = @{ "clientId" = $ClientAadApplication.AppId;"tenantId" = $tenantId;"clientSecret" = $ClientAppKey;"redirectUri" = $ClientAadApplication.ReplyUrls;"postLogoutRedirectUri" = $ClientAadApplication.HomePage };
253253
UpdateTextFile -configFilePath $configFile -dictionary $dictionary
254254

255255
Add-Content -Value "</tbody></table></body></html>" -Path createdApps.html

0 commit comments

Comments
 (0)