Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

New Service principal script fails on getting the TenantId

(0) ShareShare
ReportReport
Posted on by

I keep getting the following error message when follwoing the steps from this Article 

\New-CrmServicePrincipal.ps1 : A parameter cannot be found that matches parameter name 'TenantId'.
At line:1 char:1
+ .\New-CrmServicePrincipal.ps1 -TenantLocation "Europe"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-CrmServicePrincipal.ps1], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,New-CrmServicePrincipal.ps1

 

Is there a solution for this problem?

  • Verified answer
    David Jenni Profile Picture
    Microsoft Employee on at
    Re: New Service principal script fails on getting the TenantId

    @Anonymous @Ale1981 I can repro your issue, once I have the 2.x version of the OnlineManagementAPI PS modules installed in my scope.

    The 2.x version of this PS module has breaking changes  to accommodate the switch to the BAP admin API (as indicated by the major version). This causes the New-CrmServicePrincipal script to fail, as it expects the 1.2.x version. I'll file a bug to update/publish this script to only run with the 1.2.x versions.

    To work around for now, I recommend uninstalling the 2.x of OnlineManagementAPI (and install the successor module, Microsoft.PowerApps.Administration.PowerShell)

    > Uninstall-Module Microsoft.Xrm.OnlineManagementAPI -MinimumVersion 2.0 -Force
    confirm it is removed with:
    > gmo -ListAvailable Microsoft.Xrm.OnlineManagementAPI

     

    when running the New-CrmServicePrincipal with the -Verbose switch to confirm it only loads the 1.2.x version (or to produce more detail if there is more debugging necessary)

     

     



  • Alejandro Cesetti Profile Picture
    7 on at
    Re: New Service principal script fails on getting the TenantId

    I am getting the same error. I'll keep working to see if I understand why but if anyone has an answer I look forward to it 😉

     

    FYI @DavidJen 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard