Site icon TheWindowsUpdate.com

How to build a Power Platform Canvas App which uses Dataverse for authentication

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

My name is Rachel Irabor, I am a Microsoft Learn Student Ambassadors and Power Platform developer. I love writing blog posts to document my learning. 

 

In this blog post, I will show you how to create a table in Microsoft Dataverse and a Sign in screen in Canvas Power Apps using the table in Microsoft Dataverse as a data store for username and password/ Throughout the sign-in screen, we will work on making the screen user-friendly. This blog will guide you through how to build a sign-in screen in Microsoft Power Apps using Microsoft Dataverse.

 

The Step by step process

Step 1: 

Sign into your Microsoft Power Apps Account

At the left-hand side of the screen, click on the hamburger icon, then click on Table

 

 

Step 2: 

It is possible to use an already existing table in Dataverse that relates to your data.  Here we will be creating a new table in Dataverse. 

Click on + New Table.

Next, click on New Table

Display name is User.

Click on Enable attachments (including notes and files) 

Click on Save

 

 

 

 

Step 3:

Add the Email Address column to the table. 

 

 

 

Step 4:

Add the Password column to the table. 

 

 

 

Note: You can add more columns to the table, like the user's information (Name, gender, address), but for the sign-in screen, we will only be using the email address and password from the table. 

 

 

Step 5:

The User table has a primary key column available, but it is related to the GUID Field. To create the User Id column will be using the data type, Autonumber.

After clicking on Save, I had an error message because the table's GUID column uses the same schema name. To solve this, click on the Advanced options and change the Schema name from userid to registereduserid.

Click on Save

 

 

 

 

Step 6:

Create the Sign-in Screen

 

 

 

 

Step 7:

Click on Insert

Search for Image, Add the image control to the App

 

 

Step 8:

Expand the height and weight of the Image control 

Width: 60 

Height: 479

When adding the image to the image control, there is an option of adding the from your image file in your desktop/laptop. 

To add an image to the control. For this we are going to be adding the Image link address to the image property 

 

The image address link

https://th.bing.com/th/id/OIP.ia8JivgTpd9AzXUNaf3hVgHaDD?pid=ImgDet&rs=1

 

Add this to the image property of the image control

"https://th.bing.com/th/id/OIP.ia8JivgTpd9AzXUNaf3hVgHaDD?pid=ImgDet&rs=1"

 

 

 

 

 

Step 9: 

Add text input control to the screen

Click on Insert

Next click on Text input

Copy the Text input control and paste it

To paste it Ctrl + P

Make sure they are both in the same line (check the images here to understand better)

Rename Text input 3 to Email address

Rename Text input 3_1 to Password

 

 

 

 

 

Step 10:

Click on Email address at the left hand side of the screen

            Self.Fill

                       RGBA(0,0,0,1)

 

 

 

 

 

 

 

Step 11:

Click on Password at the left hand side of the screen

 

            Self.Fill

 

                       RGBA(0,0,0,1)

 

 

 

 

 

 

 

Step 12:

Click on Insert 

Click on Button

Change the text property of the button control from Button to Sign in 

Change the Fill property of the button control

      RGBA(49,49,168,1)

 

Change the HoverFill property of the button control

   Self.Fill

 

Change the FontWeight property of the button control to 

         FontWeight.Bold

 

 

 

 

 

 

I changed the Fill property from blue. I felt it was not too visible and easy for my eyes. 

Let me know what you think, with me changing the background colour of the button to Pink

 

 

Step 13:

Add the data source to the App

 

 

 

 

 

 

 

Step 14:

Add a new screen to the app. The reason for this is that, when the sign in button is clicked on and the email address and password is correct, it should navigate the user to the home screen/next screen.

 

 

 

 

 

 

Step 15:

For this to work Change the Text input; Email address to Emailaddress to make it

easier for us to use it in the formula.

I had issue with using the name Password for my text input control. Please change this to textinput1

 

On the OnSelect property of the button control copy and paste this:

 

Set(CurrentSignedInUser,LookUp('User Tables', 'Email Address' = Emailaddress.Text, 'User ID')); If( IsBlankOrError( LookUp( 'User Tables', 'Email Address' = Emailaddress.Text And Password = Textinput1.Text, 'Email Address' ) ), Set( DisplayErrorMessage, true ), Navigate( 'Screen2', ScreenTransition.Fade ) ) ; Reset(Emailaddress) ;Reset(Textinput1)

 

 

 

 

 

In Step 15 

I noticed that my the reference to my User table, the column in my table were not coming up like Email Address and Password. I went back to the Table in Dataverse and noticed I had another table in Dataverse with the same name. I changed my table name from User to User Table and re-added the data source/table to the App. Hopefully you did not have the same issue that I did 

 

 

Step 16: 

Copy and paste the button control  

Change the OnSelect property to this;

 

Set( DisplayErrorMessage, false )

 

 

Change the Visible Property to

       DisplayErrorMessage

 

Change the Text property to Try Again

 

 

 

 

 

 

 

Step 17:

Add label control to the screen

                DisplayErrorMessage

 

 

 

 

 

 

 

Always remember to save your App. 

Click on Ctrl + S

 

 

Learn more on Microsoft Power Apps & Dataverse

Overview of creating apps in Power Apps

Get started with Power Apps canvas apps

What is Microsoft Dataverse? - Power Apps

Introduction to Dataverse - Training

 

 

 

 

 

 

 

Exit mobile version