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 / Code Apps - Environmen...
Power Apps
Suggested Answer

Code Apps - Environment not found

(1) ShareShare
ReportReport
Posted on by 15
Hi,
 
Trying to initialize my demo Code App to my environment, from VS Code using PAC CLI v.2.6.4. 
 
 
My auth profile is configured to an environment where Code Apps is activated. When running pac code init --displayname "App From Scratch" I get an error;
 
"Connected as mail@mail.com
Environment '<my environment id>' not found. Please verify the environment ID and ensure you have access to it.
 
I have access, my auth profile pointing towards the correct env (verified by pac env who), as mentioned Code Apps is activated in Environment Settings in Admin Center and I have sys.admin role for the environment.

Found this article, where users are discussing a potential bug in the pac version, so also tried to use multiple lower versions, without any luck.
 
Any clues?
I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    1,999 Moderator on at
    try with this command 
     
    npx degit microsoft/PowerAppsCodeApps/templates/starter my-app
    cd my-app
    npm install
    npm run dev
     
    -----------------------------
    If my answer helped you, please give me a thumbs up (👍). 
    If solve your question please mark as answer ✔️. This is help the community.
    If you want talk with me just tag me @MichaelFP 
  • rjmora87 Profile Picture
    12 on at
    I'm also having this issue inside a GCC environment. "pac env who" shows the correct environment selected, but "pac code init" always comes back with "Environment not found".
     
    "pac auth who" shows the correct "UsGov" cloud and environment.
     
    I've also tried downgrading to lower versions of pac with no success.
     
    As an aside: The npm CLI (npx power-apps) won't work because it does not seem to be supported for "UsGov" cloud: GCC Region Availability · Issue #172 · microsoft/PowerAppsCodeApps
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at
    I was actually having the same issue today.
     
    In my case, the issue was that the PAC CLI was enforcing the Tenant ID from my machine domain (my Organization Tenant), however my Data verse environment was hosted in a different Tenant entirely
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 475

#2
WarrenBelz Profile Picture

WarrenBelz 387 Most Valuable Professional

#3
11manish Profile Picture

11manish 289

Last 30 days Overall leaderboard