In one of my previous articles I explained the steps to fetch the Environment ID in Power Automate flows.

In this article, lets see how to leverage Canvas Apps table data source, to fetch the Environment ID in Canvas App.

What is Environment Id

  • In Power Platform, Environment is a space to store, manage, and share your organization’s business data, apps, chatbots, and flows.
  • Every Environment will be associated with an unique identifier.

Steps to fetch the Environment ID in Canvas App:

  • Add the Canvas Apps table data source to your Canvas App.
  • Add a Button and on onselect paste the following formula
Set(CurrentAppUri, First('Canvas Apps').AppOpenUri);
Set(CurrentEnvironmentID, Right(Match(CurrentAppUri,"/e/.*(?=/a)").FullMatch,36));
  • If you notice the formula, Environment ID has been captured and got set in to ‘CurrentEnvironmentID’ variable.
  • Add a label to display the Environment ID.

🙂

Advertisements
Advertisements

4 responses to “Canvas App | Get Environment ID without the need of cloud flow”

  1. Canvas App/Custom Page | Get the current Environment URL | Rajeev Pentyala - Microsoft Power Platform Avatar

    […] my previous article, I explained the steps to fetch the ‘Environment ID’ without the need of cloud […]

  2. Kurt Reynolds Avatar
    Kurt Reynolds

    Great Article Rajeev, just found this and it saved me quite a bit of time, I was using Power Automate before.

  3. alex minagall Avatar
    alex minagall

    Set(CurrentEnvironmentID, Right(Match(CurrentAppUri,"/e/.*(?=/a/)").FullMatch,36));

    the above is slightly more robust, that way if your environment ID starts with ‘a’, the full match will not begin 1 character late 🙂

Leave a reply to SharePoint Site with Env GUID Shared safely across PowerPlatform Lifecycle | SPJeff Cancel reply