web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Creating a new environ...
Power Apps
Answered

Creating a new environment with PowerShell

(0) ShareShare
ReportReport
Posted on by 103

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

I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,024 Most Valuable Professional on at

    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.

  • ashlega Profile Picture
    103 on at

    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

  • westerdaled Profile Picture
    649 on at

    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

     

     

  • Pstork1 Profile Picture
    69,024 Most Valuable Professional on at

    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
    649 on at

    Ok

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard