Connect-AzureAd
$ProjectRequiredApps = Get-AzureADServicePrincipal -Filter "
AppId eq '00000007-0000-0000-c000-000000000000'
or AppId eq '475226c6-020e-4fb2-8a90-7a972cbfc1d4'
or AppId eq '637fcc9f-4a9b-4aaa-8713-a2a3cfda1505'
or AppId eq '7df0a125-d3be-4c96-aa54-591f83ff541c'
or AppId eq '39e6ea5b-4aa4-4df2-808b-b6b5fb8ada6f'
or AppId eq 'f53895d3-095d-408f-8e93-8f94b391404e'
"
$ProjectRequiredApps | Select DisplayName, AppID, ObjectID, AccountEnabled, AppRoleAssignmentRequired, ReplyURLs | ft
#Check that all required Enterprise Apps are present. Create hashtable to check that app exists and if so remove from list. Entries left behind means it's missing.
[hashtable]$EntApps = [ordered]@{"Dataverse" = "00000007-0000-0000-c000-000000000000"
"Microsoft Flow Service" = "7df0a125-d3be-4c96-aa54-591f83ff541c"
"Dynamics Provision" = "39e6ea5b-4aa4-4df2-808b-b6b5fb8ada6f"
"Dynamics CRM Online Administration" = "637fcc9f-4a9b-4aaa-8713-a2a3cfda1505"
"PowerApps Service" = "475226c6-020e-4fb2-8a90-7a972cbfc1d4"
"Portfolios" = "f53895d3-095d-408f-8e93-8f94b391404e"
}
Foreach ($App in $ProjectRequiredApps) #Remove from hashtable if app exist.
{
If ($EntApps.Item($App.DisplayName))
{
$EntApps.Remove($App.DisplayName)
}
}
If ($EntApps.Count -gt 0)
{
Write-Host "Check#1: One or more required Enterprise Apps are missing." -ForegroundColor Red
Write-Host "Please check that you have 1 or more of the following subscriptions: Planner Plan 1, Planner and Project Plan 3, or Planner and Project Plan 5." -ForegroundColor Red
$EntApps | ft -a
}
else
{
Write-Host "Check#1: All required Enterprise Apps are present." -ForegroundColor Yellow
}
#Check that required apps are enabled (AccountEnabled=True) if not display message to enable the required Enterprise Apps.
If ($ProjectRequiredApps | ? {$_.AccountEnabled -eq $false})
{
Write-Host "Check#2: The following required AAD Enterprise App is disabled."
Write-Host "Instructions on how to enable the required app via Azure Active Directory Admin Center are at: https://learn.microsoft.com/project-for-the-web/deploying-project" -ForegroundColor Red
Write-Host "If you prefer using Powershell, for each App in the list use the Powershell cmdlet ""Set-AzureADServicePrincipal"" to enable the app." -ForegroundColor Red
Write-Host "Example:`n" -ForegroundColor Red
Write-Host " Set-AzureADServicePrincipal -ObjectId "“ObjectId GUID from below output."”-AccountEnabled `$true" -ForegroundColor Red
Write-Host "`nMore info on the cmdlet ""Set-AzureADServicePrincipal can be found"" at: https://learn.microsoft.com/powershell/module/azuread/set-azureadserviceprincipal" -ForegroundColor Red
$ProjectRequiredApps | Select DisplayName, AppID, ObjectID, AccountEnabled | ? {$_.AccountEnabled -eq $false} | ft
}
Else
{
Write-Host "Check#2: All required Enterprise Apps are enabled." -ForegroundColor Yellow
}
#Check that AppRoleAssignmentRequired for all required apps is set to False (AppRoleAssignmentRequired=False).
If ($ProjectRequiredApps | ? {$_.AppRoleAssignmentRequired -eq $true})
{
Write-Host "Check#3: The AppRoleAssignmentRequired property for the specified Enterprise App is set to True." -ForegroundColor Red
Write-Host "Out of box this setting should be set to False. If set to True, it can prevent Project for the Web from working correctly." -ForegroundColor Red
Write-Host "This setting can only be modified via Powershell, for each App in the list use the Powershell cmdlet ""Set-AzureADServicePrincipal"" to change the AppRoleAssignmentRequired to False." -ForegroundColor Red
Write-Host "Example:`n" -ForegroundColor Red
Write-Host " Set-AzureADServicePrincipal -ObjectId "“ObjectId GUID from below output."”-AppRoleAssignmentRequired `$false" -ForegroundColor Red
Write-Host "`nMore info on the cmdlet ""Set-AzureADServicePrincipal can be found"" at: https://learn.microsoft.com/powershell/module/azuread/set-azureadserviceprincipal" -ForegroundColor Red
$ProjectRequiredApps | Select DisplayName, AppID, ObjectID, AccountEnabled, AppRoleAssignmentRequired | ? {$_.AppRoleAssignmentRequired -eq $true} | ft -a
}
Else
{
Write-Host "Check#3: The AppRoleAssignmentRequired property for all required Enterprise Applications are set correctly." -ForegroundColor Yellow
}