Fix New-MsolServicePrincipalCredential Invalid Parameter Errors in Microsoft 365
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.

- 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.
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.
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.
Open Windows PowerShell as an administrator and run Connect-MsolService to authenticate to the Microsoft 365 tenant.
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)).
Run New-MsolServicePrincipalCredential -AppPrincipalId <ID> -Type asymmetric -Value $CredValue, replacing <ID> with the correct service principal ID.
Run Get-MsolServicePrincipalCredential -AppPrincipalId <ID> -ReturnKeyValues $false to confirm that the new certificate credential appears for the service principal.

Check well-known Microsoft 365 service principal IDs and certificate requirements
Use this solution when you need to confirm the correct AppPrincipalId or validate that the certificate format matches Microsoft documentation.
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.

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.




