When I was working on a Power Apps and Power Automate solution for a client who wanted to create SharePoint sites automatically.
Users would fill in details such as site title, internal name, storage quota, description, owners, members, and visitors in Power Apps. After submitting the form, Power Automate creates the SharePoint site using a REST API call.
I wanted this solution to be reusable. That means anyone should be able to import this solution into any tenant and use it without changing the app or flow.
To achieve this, we need to get the tenant name dynamically.
However, Power Apps does not provide any built-in function to get the tenant name.
I asked a few colleagues about this, and one suggested storing the tenant name in a SharePoint list and reading it in Power Apps. But this approach is not truly dynamic and requires manual updates whenever the solution is imported into a new tenant.
After some time, I got a better idea.
Since I am building this Power Apps inside a Solution, I created an environment variable in the solution. When someone imports the solution into their tenant, they only need to provide the SharePoint site URL. From that site URL, we can extract the tenant name dynamically and use it in Power Apps and Power Automate.
In this tutorial, I will show you how to get the tenant name in Power Apps using this approach.
Get Tenant Name In Power Apps
For this example, I created a Power Apps Solution with an Environment variable named Site Address.

Then, I create a blank canvas app inside this solution.

Now I want to show the Tenant Name in the Power Apps.
To do this, follow the steps below:
- Open the Power Apps where you want to show the tenant name. Then, in the Data tab, click the + Add data.

- Then connect Environment Variable Definitions and Environment Variable Values from Microsoft Dataverse.

- Next, add a Text label to the Power Apps.

- In the Text property, provide the following formula:
LookUp(
'Environment Variable Values',
'Environment Variable Definition'.'Schema Name' = "tsinfo_GetTenantName",
Value
)
Where:
- LookUp(): LookUp searches for a single record in a table that matches a condition.
- Environment Variable Values: This table stores the actual values of environment variables.
- Environment Variable Definition: This is a lookup column that points to the definition.
- Schema Name: The unique name of the environment variable.
- tsinfo_GetTenantName: Name of the Schema.
- Value: It returns the Value column (the actual stored value of the environment variable).

- Now you can see it will return the Site Address.

Now that we have the Site Address in place, we can extract the tenant name from it.
- Next, add another text control and provide the formula below.
First(
Split(
Substitute(
LookUp(
'Environment Variable Values',
'Environment Variable Definition'.'Schema Name' = "tsinfo_GetTenantName",
Value
),
"https://",
""
),
"."
)
).Value

- Then you can see the tenant name in the Power Apps.

In this tutorial, we learned how to get the tenant name in Power Apps. We used an environment variable to store the SharePoint site address and then extracted the tenant name from that URL.
Also, you may like some more Power Apps tutorials:
- Power Apps Charts Tutorial
- Power Apps Dataverse Yes/No Field
- Meet Power Apps Vibe: The AI-Native Power Apps Experience
- Power Apps Modern Table Control
- Increment Number in Power Apps Gallery
- Set Up Power Apps Gallery Border Between Items

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.