diff --git a/PSModule/M365Documentation/Functions/New-M365DocAppRegistration.ps1 b/PSModule/M365Documentation/Functions/New-M365DocAppRegistration.ps1 index 1e33a89..dfc6be6 100644 --- a/PSModule/M365Documentation/Functions/New-M365DocAppRegistration.ps1 +++ b/PSModule/M365Documentation/Functions/New-M365DocAppRegistration.ps1 @@ -39,12 +39,16 @@ Function New-M365DocAppRegistration(){ } #region Authentication - Connect-AzureAD | Out-Null + try{ + Get-AzureADContract -ErrorAction Stop | Out-Null + } catch { + Write-Error "You must call the Connect-AzureAD cmdlet before calling this cmdlet." -ErrorAction Stop + } #endregion #region Main Script ######################################################## - $displayName = "WPNinjas.eu Automatic Documentation" + $displayName = "WPNinjas.eu Automatic Documentation Custom 2" $appPermissionsRequired = @("AccessReview.Read.All","Agreement.Read.All","AppCatalog.Read.All","Application.Read.All","CloudPC.Read.All","ConsentRequest.Read.All","Device.Read.All","DeviceManagementApps.Read.All","DeviceManagementConfiguration.Read.All","DeviceManagementManagedDevices.Read.All","DeviceManagementRBAC.Read.All","DeviceManagementServiceConfig.Read.All","Directory.Read.All","Domain.Read.All","Organization.Read.All","Policy.Read.All","Policy.ReadWrite.AuthenticationMethod","Policy.ReadWrite.FeatureRollout","PrintConnector.Read.All","Printer.Read.All","PrinterShare.Read.All","PrintSettings.Read.All","PrivilegedAccess.Read.AzureAD","PrivilegedAccess.Read.AzureADGroup","PrivilegedAccess.Read.AzureResources","User.Read" ,"IdentityProvider.Read.All","InformationProtectionPolicy.Read.All" ) $targetServicePrincipalName = 'Microsoft Graph'