@@ -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