Cannot bind argument to parameter ServicePrincipalID for Office 365 OrgSettings
Description of the issue
I try to deploy the Office365 Organization Settings using Microsoft 365 DSC. The permissions on my App registration are set correctly and the DSC Configuration can be found below. The build configuration succeeded but the deployment fails with the following error: Cannot bind argument to parameter ServicePrincipalID
Microsoft 365 DSC Version
1.23.1129.1
Which workloads are affected
Office 365 Admin
The DSC configuration
Configuration on the Basic#Office365.psd1 file:
@{
NonNodeData = @{
AzureAD = @{}
Exchange = @{}
Intune = @{}
Office365 = @{
OrgCustomizationSetting = @{
Ensure = 'Present'
IsSingleInstance = "Yes"
}
AdminAuditLogConfig = @{
IsSingleInstance = "Yes"
Ensure = 'Present'
UnifiedAuditLogIngestionEnabled = 'Enabled'
}
OrgSettings = @{
IsSingleInstance = "Yes"
FormsIsInOrgFormsPhishingScanEnabled = $True
M365WebEnableUsersToOpenFilesFrom3PStorage = $False
AppsAndServicesIsAppAndServicesTrialEnabled = $False
AppsAndServicesIsOfficeStoreEnabled = $False
}
}
OneDrive = @{}
Planner = @{}
PowerPlatform = @{}
SecurityCompliance = @{}
SharePoint = @{}
Teams = @{}
}
}
Verbose logs showing the problem
isExternalShareCollaborationEnabled=False
isExternalShareResultEnabled=False
isExternalShareTemplateEnabled=False
isInOrgFormsPhishingScanEnabled=True
isRecordIdentityByDefaultEnabled=False
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating the Dynamics 365 Customer Voice
settings with values:isInOrgFormsPhishingScanEnabled=False
isRecordIdentityByDefaultEnabled=False
isRestrictedSurveyAccessEnabled=False
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating the Apps & Settings settings with
values:isAppAndServicesTrialEnabled=False
isOfficeStoreEnabled=False
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating the To Do settings with
values:isExternalJoinEnabled=False
isExternalShareEnabled=False
isPushNotificationEnabled=False
VERBOSE: [fv-az770-435]: LCM: [ End Set ]
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] in 13.4860 seconds.
##[error]The PowerShell DSC resource '[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration' with SourceInfo
'::3::1::O365OrgSettings' threw one or more non-terminating errors while running the Set-TargetResource functionality.
These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more
details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
Environment Information + PowerShell Version
No response
Additional error logs:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Registering the Office on the web Service
Principal
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating the Microsoft 365 On the Web
setting to {False}
##[error]Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Update-MgServicePrincipal
+ PSComputerName : localhost
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating the Planner Allow Calendar Sharing
setting to {False}
##[error]The remote server returned an error: (403) Forbidden.
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:) [], CimException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
+ PSComputerName : localhost
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating Viva Insights settings for Web
Experience
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating Viva Insights settings for Digest
Email
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating Viva Insights settings for Addin
and Inline Suggestions
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating Viva Insights settings for
ScheduleSendSuggestions
VERBOSE: [fv-az770-435]:
[[O365OrgSettings]OrgSettingsDefaults::[Office365]Office365_Configuration] Updating the Admin Center Report Display
Concealed Names setting to {False}
##[error]Response status code does not indicate success: Forbidden (Forbidden).
+ CategoryInfo : InvalidOperation: (Method: PATCH, ...ication/json
}:) [], CimException
+ FullyQualifiedErrorId : InvokeGraphHttpResponseException,Microsoft.Graph.PowerShell.Authentication.Cmdlets.Invok
eMgGraphRequest
+ PSComputerName : localhost
VERBOSE: [fv-az770-435]:
Code was updated to retry on error. If the SPN is not found at all, it will be created during Get operation.