Microsoft 365 Error Codes

Fix New-MsolServicePrincipalCredential Invalid Parameter Errors in Microsoft 365

Steven ParkerSteven Parker Nov 13, 2026 868 views

Question details

The user needs to resolve the invalid parameter error returned by New-MsolServicePrincipalCredential when registering an X.509 certificate for an Azure or Microsoft 365 service principal.

Fix New-MsolServicePrincipalCredential Invalid Parameter Errors in Microsoft 365
Product
Microsoft 365 / Azure Active Directory PowerShell (MSOnline module)
Device & OS
not provided
Scenario
Registering a certificate credential for a Microsoft 365 service principal, such as the Azure MFA Client Service Principal or Exchange Online service principal.
Observed behavior
New-MsolServicePrincipalCredential returns an invalid parameter error and the certificate credential is not registered.
Before you start

Collect the target service principal ID and the Base64-encoded public X.509 certificate value, and confirm that the MSOnline PowerShell module is imported before running the cmdlet.

Solution 1Recommended

Run New-MsolServicePrincipalCredential with the correct AppPrincipalId, asymmetric type, and Base64 certificate value

Use this solution when the invalid parameter error is caused by incorrect parameters or an incorrectly encoded certificate value.

The New-MsolServicePrincipalCredential cmdlet requires the target application principal ID, the asymmetric credential type, and a valid Base64-encoded public X.509 certificate. Missing or incorrectly formatted values are the most common cause of the invalid parameter error.

1
Open Windows PowerShell and connect to Microsoft 365

Open Windows PowerShell as an administrator and run Connect-MsolService to authenticate to the Microsoft 365 tenant.

2
Encode the public certificate to Base64

Export or locate the public X.509 certificate, then create the credential value with $CredValue = [Convert]::ToBase64String((Get-Content -Path C:\cert.cer -Encoding Byte)).

3
Run the New-MsolServicePrincipalCredential command

Run New-MsolServicePrincipalCredential -AppPrincipalId <ID> -Type asymmetric -Value $CredValue, replacing <ID> with the correct service principal ID.

4
Verify the registered credential

Run Get-MsolServicePrincipalCredential -AppPrincipalId <ID> -ReturnKeyValues $false to confirm that the new certificate credential appears for the service principal.

Run New-MsolServicePrincipalCredential with the correct AppPrincipalId, asymmetric type, and Base64 certificate value
Credential registered: When the command completes without error, the certificate credential is registered for the selected Microsoft 365 service principal.
Free Microsoft Office alternative

Use WPS Office as a Free Microsoft Office Alternative While Resolving Microsoft 365 Service Principal Issues

The New-MsolServicePrincipalCredential invalid parameter error is a Microsoft 365 and Azure AD PowerShell issue. WPS Office does not manage Azure service principal credentials, but it provides a free, lightweight Office suite with Word, Excel, PowerPoint, and PDF tools that opens and saves Microsoft Office formats for uninterrupted document work.

Free and lightweight alternative to Microsoft 365 desktop appsOpens and saves .docx, .xlsx, .pptx and other Microsoft Office formatsFamiliar ribbon interface for a smooth transition from Microsoft OfficeBuilt-in PDF tools help you continue routine document work during Microsoft 365 administration
microsoft office alternative - wps office

Frequently Asked Questions

What causes the invalid parameter error in New-MsolServicePrincipalCredential?

The most common causes are an incorrect AppPrincipalId, using the wrong credential type, or passing a certificate value that is not a valid Base64-encoded public X.509 certificate. Verify all three values before rerunning the command.

What parameter values should I use for Microsoft 365 service principals?

Use the application principal ID for the target service, set -Type to asymmetric, and set -Value to the Base64-encoded public X.509 certificate. Well-known IDs include Exchange 00000002-0000-0ff1-ce00-000000000000 and SharePoint 00000003-0000-0ff1-ce00-000000000000.

How do I convert an X.509 certificate to the required Base64 value?

Export the public certificate as a Base-64 encoded .cer file, then in PowerShell run $CredValue = [Convert]::ToBase64String((Get-Content -Path C:\cert.cer -Encoding Byte)).

Does WPS Office fix New-MsolServicePrincipalCredential errors?

No, WPS Office does not manage Microsoft 365 service principal credentials. It is a free Office suite alternative for creating and editing Word, Excel, and PowerPoint files while you resolve Microsoft 365 administrative issues.

Which service principals use the asymmetric credential type?

Service principals such as the Azure MFA Client Service Principal, Exchange Online, SharePoint Online, and Lync use asymmetric certificate credentials. Always set -Type asymmetric when registering an X.509 certificate.