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

Notifications

Announcements

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)
  • westerdaled Profile Picture
    636 on at

    Ok

     

  • Pstork1 Profile Picture
    68,865 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
    636 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

     

     

  • 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

  • Verified answer
    Pstork1 Profile Picture
    68,865 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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 428

#2
WarrenBelz Profile Picture

WarrenBelz 374 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard