Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Governance and Administ...
Answered

Creating a new environment with PowerShell

(0) ShareShare
ReportReport
Posted on by 90

Hi,

  when trying to use New-AdminPowerAppEnvironment, I am getting an error:

 

New-AdminPowerAppEnvironment -DisplayName AutomatedTest -EnvironmentSku Trial -LocationName canada

 

Code : BadRequest
Description : Bad Request
Error :
Errors :
Internal : System.Net.HttpWebResponse

 

 

The same error happens with or without a call to Add-PowerAppsAccount:

 

$pass = ConvertTo-SecureString "<PASSWORD HERE>" -AsPlainText -Force
Add-PowerAppsAccount -Username <USER HERE> -Password $pass

 

Other cmdlets seem to be working. For example, I can use Get-AdminPowerAppEnvironmentLocations without any problems.

 

Thanks,

Alex

  • westerdaled Profile Picture
    616 on at
    Re: Creating a new environment with PowerShell

    Ok

     

  • Pstork1 Profile Picture
    66,287 Most Valuable Professional on at
    Re: Creating a new environment with PowerShell

    Please post this as a new topic.  This is a very old thread and you won't get much traffic here.  To get an answer please re-post.

  • westerdaled Profile Picture
    616 on at
    Re: Creating a new environment with PowerShell

    Hi

     

    Is PowerShell the preferred method for automating creating environments, I have been attempting to do this via the Power Platform tooling in VSCode without much success😫

     

    Microsoft PowerPlatform CLI
    Version: 1.14.2+g7205df7
    
    Usage: pac [admin] [application] [auth] [canvas] [help] [org] [package] [paportal] [pcf] [plugin] [solution] [telemetry]
    
    // connect to the default environment
     pac auth create --url https://org123456.crm11.dynamics.com
    
    pac admin create -n "Test" -r "United Kingdom" -t "Sandbox" -c "British Pound" -d "Test" 

    Platform create error.png

     

     

  • ashlega Profile Picture
    90 on at
    Re: Creating a new environment with PowerShell

    Yes, figured it out at some point.. turned out we can use -Verbose switch now to get those additional error details... will mark the answer

  • Verified answer
    Pstork1 Profile Picture
    66,287 Most Valuable Professional on at
    Re: Creating a new environment with PowerShell

    Are you working with a Trial license?  Although the Trial license is a P2 license you can't create additional environments if you are using a Trial account.

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

🌸 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…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Governance and Administering

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 9 Super User 2025 Season 1

#2
bscarlavai33 Profile Picture

bscarlavai33 5 Super User 2025 Season 1

#3
getsplash Profile Picture

getsplash 2

Overall leaderboard

Featured topics