Jump to content

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

Featured Replies

Posted

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

 

 

 

largevv2px999.png.419c297dc19bb1ed0304601e27f6a62f.png

 

 

 

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

 

 

 

largevv2px999.png.bb96f2f2c71e015939e0446690552dd7.png

 

 

 

largevv2px999.png.12d7e85cc5ec82351718569f013cc23f.png

 

 

 

 

 

Step 3:

 

Add the Email Address column to the table.

 

  • Scroll down and click on +
  • Display name is Email Address
  • Change the format from Text to Email
  • Click on Save

 

 

 

largevv2px999.png.e11eb01d8d444f292b4ed4f0986c0aa2.png

 

 

 

largevv2px999.png.9f441c5f9edd016a1d571d731eaac067.png

 

 

 

Step 4:

 

Add the Password column to the table.

 

  • Scroll down and click on +
  • Display name is Password
  • Click on Save

 

 

 

largevv2px999.png.5845f474a4af6cc48a780bb8b75e3e49.png

 

 

 

 

 

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.

 

  • Click on +
  • Display name is User ID
  • Change the Data type from Single line of text to Autonumber
  • Scroll down and change it to your prefered Prefix autonumber type. Here, we will be using the String prefix number
  • The Prefix to User
  • It is optional to change the minimum number of digits. For this, we will be using 4
  • Change the Seed value from 1000 to 1110 (this is optional)
  • Click on Save

 

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

 

 

 

largevv2px999.png.8a645cc35e688e1e119182a1496f2016.png

 

 

 

largevv2px999.png.878444d0033db1393f515cd4998939c9.png

 

 

 

largevv2px999.thumb.png.b4caff760e744979dfc91be41add0397.png

 

 

 

Step 6:

 

Create the Sign-in Screen

 

  • Click on Home
  • Next, click on Blank app
  • On Blank canvas, click on Create
  • Write the App name; for me I used Sign in App
  • The format is Phone
  • Click on Create
  • Next, Click on Skip

 

largevv2px999.png.339cf87e8d4ed39863ff25fa20192a44.png

 

 

 

largevv2px999.png.78ae74a50c147f53c69d425d243b1738.png

 

 

 

largevv2px999.png.c4c9dd6269d337011f11c46b17c7ef6e.png

 

 

 

largevv2px999.png.e8f0f1ab0defb7a981473c751e8eb182.png

 

 

 

Step 7:

 

Click on Insert

 

Search for Image, Add the image control to the App

 

largevv2px999.png.2f50e4e71f5b2b62c4a2cdb766df73a6.png

 

 

 

largevv2px999.png.333159d44fb0f392c3aeb239e3486c68.png

 

 

 

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"

 

 

 

largevv2px999.png.5cd2a643441086adf9e36587a45efb20.png

 

 

 

largevv2px999.png.d7cdd5f4079fe3672ce53ab0d9d19198.png

 

 

 

largevv2px999.png.191897e27f962f6e96d228ccdae0095b.png

 

 

 

 

 

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

 

 

 

largevv2px999.png.112dfc770ef33700e79326119c81d617.png

 

 

 

largevv2px999.png.5bdec97262143dc5a4d488ae4108d345.png

 

 

 

largevv2px999.png.eea3a1692db78ce6287e1cb5549f917a.png

 

 

 

largevv2px999.png.bf6006904ef4d05e324a92e9dff25208.png

 

 

 

Step 10:

 

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

 

  • At the right hand side of the screen delete Text input from the Default
  • The Hint text write Email Address
  • Scroll down the page and change the border property from blue to black
  • Change the HoverFill property of Email address

 

Self.Fill

 

  • Change the HoverBorderColor property of Email Address

 

RGBA(0,0,0,1)

 

 

 

largevv2px999.png.08b1312accff189a9df6ca92016b0aca.png

 

 

 

largevv2px999.thumb.png.c51b5270108edae4489c354d0fb54584.png

 

 

 

largevv2px999.png.41e268cc91c6925ca5e5c2dd2a25ea50.png

 

 

 

largevv2px999.thumb.png.79935f7fa8520db1abb162aaa7ddfcbb.png

 

 

 

largevv2px999.png.77625e711cb4d0e314cc61289b0dfc05.png

 

 

 

 

 

Step 11:

 

Click on Password at the left hand side of the screen

 

  • At the right hand side of the screen delete Text input from the Default
  • The Hint text write Password
  • Change the Mode from Single line text to Password
  • Scroll down the page and change the border property from blue to black

 

 

 

  • Change the HoverFill property of Email address

 

Self.Fill

 

 

 

  • Change the HoverBorderColor property of Email Address

 

RGBA(0,0,0,1)

 

 

 

largevv2px999.png.9eb5d2f764ba9be88cdb463b037ed7b8.png

 

 

 

largevv2px999.png.ff20d6818b8691d1df149fe0cfe80940.png

 

 

 

largevv2px999.png.c1f1544ab871ec48ea033c2ee6331cbe.png

 

 

 

largevv2px999.png.bdb9004adca799198f1365758d7bfd65.png

 

 

 

largevv2px999.png.42e8fcdbe46f62226214e2431f9887f6.png

 

 

 

 

 

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

 

 

 

 

 

largevv2px999.thumb.png.a7b1574052a4e9726b218f5f7953bf53.png

 

 

 

largevv2px999.png.6fcbf1165a2dfe9d4c04ac98398ea8d1.png

 

 

 

largevv2px999.png.3346cb4af33c51ed7f3fdca1a7855444.png

 

 

 

 

 

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

 

 

 

largevv2px999.png.9d220c65d528d561aec9bdf7961c19ac.png

 

 

 

Step 13:

 

Add the data source to the App

 

  • Click on the data icon
  • Click on Add data
  • Click on Tables
  • Search the name of your table
  • Click on the name of your table
  • The table has been added to your app

 

 

 

largevv2px999.png.817e5bf0136e77aed49289913199812c.png

 

 

 

largevv2px999.png.179f51571b4603f9535cde484a1085bd.png

 

 

 

largevv2px999.png.0c6e9541d55cb9ac5ca96c2bb8d1f4dd.png

 

 

 

largevv2px999.png.9d867e2f2dafcba5c4f600aa336e7b2d.png

 

 

 

largevv2px999.png.cf423362df0aceeb7c4bce38b5d5f3e9.png

 

 

 

 

 

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.

 

 

 

  • Click on New Screen
  • Click on Blank

 

 

 

largevv2px999.png.e5b4e4fddc1773f017d589f994edfc61.png

 

 

 

largevv2px999.png.0b57ef1c960c05b920fe6abdeb15b5a5.png

 

 

 

largevv2px999.png.68054f85b7554eb3b7c946939edef51b.png

 

 

 

 

 

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)

 

 

 

 

 

 

 

 

 

largevv2px999.png.67c04dc3d911420e7c4dc710f693d1a6.png

 

 

 

 

 

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

 

 

 

 

 

largevv2px999.thumb.png.0ee1f6612e03fa64c101ce8590cbd333.png

 

 

 

largevv2px999.png.8f69accdeaececa7da5675dd9a026d71.png

 

 

 

 

 

largevv2px999.png.61a79bac58d582ff0cac3959d60fbe7c.png

 

 

 

 

 

Step 17:

 

Add label control to the screen

 

  • Change the text property of the label control to Incorrect Password
  • Change the colour of the font from black to red and align the text to centre
  • Change the Visible property of the label control to the variable:

 

DisplayErrorMessage

 

 

 

largevv2px999.png.eeef3618e836aa9ed9c4639adde4ec12.png

 

 

 

 

 

largevv2px999.png.f51c728ceb903490f92dc788813c1854.png

 

 

 

largevv2px999.png.3c1d3043f0dd05be9ac717a204cbed45.png

 

 

 

largevv2px999.png.74143449fb38a43f3dcd7d8d468bf98c.png

 

 

 

largevv2px999.png.09096baddfd2d2a8f123db6425d3a6f1.png

 

 

 

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

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...