{"id":810,"date":"2023-12-06T08:00:58","date_gmt":"2023-12-06T16:00:58","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powerplatform\/?p=810"},"modified":"2023-12-06T11:30:18","modified_gmt":"2023-12-06T19:30:18","slug":"power-platform-cli-simplifying-authentication-profiles","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powerplatform\/power-platform-cli-simplifying-authentication-profiles\/","title":{"rendered":"Power Platform CLI &#8211; Simplifying authentication profiles"},"content":{"rendered":"<p>Good day developers!<\/p>\n<p><a href=\"https:\/\/learn.microsoft.com\/power-platform\/developer\/cli\/introduction\">Power Platform CLI<\/a> is a one stop command line interface to interact with Power Platform &#8211; aka PAC CLI.<\/p>\n<p>We have 3 different kinds of authentication profiles. In the version 1.16 of PAC CLI, we started to deprecate the parameter <code>--kind<\/code> and since then, UNIVERSAL is the default profile kind.<\/p>\n<p><strong>In this post, I will explain why we have different authentication profile kind, what is the intention of each type and what kind of profile you should use.<\/strong><\/p>\n<h2>\ud83d\udca1 What is an authentication profile?<\/h2>\n<p>Before you can create environments on <a href=\"https:\/\/aka.ms\/ppac\">Power Platform admin center<\/a>, or create apps on <a href=\"https:\/\/make.powerapps.com\">Power Apps<\/a>, you need to authenticate. PAC CLI is not different. By using <code>'pac auth'<\/code> command you can store, update and delete authentication profiles in your computer.<\/p>\n<p>If you don&#8217;t have an authentication profile, the first time you run any <code>pac<\/code> command that requires one, if you are using windows and logged using an AAD account associated to Power Platform, a new Universal authentication profile will be create for you.<\/p>\n<p>If you are using it anywhere else, or if you want to use a different account, you can use <code>'pac auth create'<\/code>. A browser will open, so you can select your account to login. If you are using GitHub Codespaces, you will get the equivalent of <code>--deviceCode<\/code> parameter. Yes, there are quite a few parameters you can use.<\/p>\n<blockquote>\n<p>To see all parameter available, you can use <a href=\"https:\/\/learn.microsoft.com\/power-platform\/developer\/cli\/reference\/auth#pac-auth-create\">pac auth create help<\/a><\/p>\n<\/blockquote>\n<p><figure id=\"attachment_813\" aria-labelledby=\"figcaption_attachment_813\" class=\"wp-caption aligncenter\" ><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-help.png\" alt=\"Image pac auth help\" width=\"1401\" height=\"729\" class=\"size-full wp-image-813\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-help.png 1401w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-help-300x156.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-help-1024x533.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-help-768x400.png 768w\" sizes=\"(max-width: 1401px) 100vw, 1401px\" \/><figcaption id=\"figcaption_attachment_813\" class=\"wp-caption-text\">&#8216;pac auth create&#8217; parameters.<\/figcaption><\/figure><\/p>\n<p>Let&#8217;s dig deeper on the <code>--kind<\/code> parameter, and why we are deprecating it.<\/p>\n<h2>\ud83d\udca1 Why we have authentication profile kind?<\/h2>\n<p>The short answer is, for historical reasons.<\/p>\n<p>With pac cli, you can run commands that will perform &#8216;ADMIN&#8217; operations. List environments, create environments, list tenant settings. In this scenario, it is irrelevant what is my active environment (I might not have one). This is where an &#8216;ADMIN&#8217; kind of profile is used.<\/p>\n<p><figure id=\"attachment_818\" aria-labelledby=\"figcaption_attachment_818\" class=\"wp-caption aligncenter\" ><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-admin-profile.png\" alt=\"Creation of an authentication profile of the kind &quot;ADMIN&quot;\" width=\"1396\" height=\"146\" class=\"size-full wp-image-818\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-admin-profile.png 1396w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-admin-profile-300x31.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-admin-profile-1024x107.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-admin-profile-768x80.png 768w\" sizes=\"(max-width: 1396px) 100vw, 1396px\" \/><figcaption id=\"figcaption_attachment_818\" class=\"wp-caption-text\">Creating an &#8220;ADMIN&#8221; kind authentication profile.<\/figcaption><\/figure><\/p>\n<p>There are some commands that will require an active environment. If I only have one &#8216;ADMIN&#8217; profile and try to run the command <code>'pac org who'<\/code>, I will get the error bellow: <figure id=\"attachment_819\" aria-labelledby=\"figcaption_attachment_819\" class=\"wp-caption aligncenter\" ><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-admin-error.png\" alt=\"Error: No auth profiles were found on this computer. Please run &#039;pac auth create&#039; to create one.\" width=\"1019\" height=\"197\" class=\"size-full wp-image-819\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-admin-error.png 1019w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-admin-error-300x58.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-admin-error-768x148.png 768w\" sizes=\"(max-width: 1019px) 100vw, 1019px\" \/><figcaption id=\"figcaption_attachment_819\" class=\"wp-caption-text\">Error: No auth profiles were found on this computer. Please run &#8216;pac auth create&#8217; to create one.<\/figcaption><\/figure><\/p>\n<p>That&#8217;s where I would need to create an authentication profile with an active environment. This is the &#8216;DATAVERSE&#8217; kind. <figure id=\"attachment_820\" aria-labelledby=\"figcaption_attachment_820\" class=\"wp-caption aligncenter\" ><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-dataverse-profile.png\" alt=\"Dataverse authentication profile\" width=\"1409\" height=\"391\" class=\"size-full wp-image-820\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-dataverse-profile.png 1409w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-dataverse-profile-300x83.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-dataverse-profile-1024x284.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-dataverse-profile-768x213.png 768w\" sizes=\"(max-width: 1409px) 100vw, 1409px\" \/><figcaption id=\"figcaption_attachment_820\" class=\"wp-caption-text\">Creating a &#8220;Dataverse&#8221; kind authentication profile<\/figcaption><\/figure><\/p>\n<p>Now I have two profiles &#8211; one to perform admin operations, and another to perform actions in a specific Dataverse environment.<\/p>\n<h2>\ud83d\udc69\u200d\ud83d\udcbb The UNIVERSAL profile<\/h2>\n<p>To simplify, we created the UNIVERSAL profile. We can infer what kind of profile you need to use based on the context.<\/p>\n<p>When you use <code>'pac auth create'<\/code>, the active environment will be your default environment. You can use the parameter <code>--environment<\/code> to specify the active environment.<\/p>\n<p>To change the active environment of your current UNIVERSAL profile, use <code>'pac env select'<\/code>.<figure id=\"attachment_853\" aria-labelledby=\"figcaption_attachment_853\" class=\"wp-caption aligncenter\" ><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-universal.png\" alt=\"Creating universal authentication profile and changing active environment.\" width=\"1486\" height=\"614\" class=\"size-full wp-image-853\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-universal.png 1486w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-universal-300x124.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-universal-1024x423.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-auth-universal-768x317.png 768w\" sizes=\"(max-width: 1486px) 100vw, 1486px\" \/><figcaption id=\"figcaption_attachment_853\" class=\"wp-caption-text\">Creating universal authentication profile and changing active environment.<\/figcaption><\/figure><\/p>\n<p>In the current pac cli version, you still can use &#8211;kind parameter to create ADMIN and DATAVERSE profiles. The parameter &#8211;url still creates a Dataverse profile by default. <strong>This will change. Moving forward, we will ALWAYS use UNIVERSAL profiles.<\/strong> Other profiles will still work (we don&#8217;t want to break any current usage), but we will make it harder to create any other type than UNIVERSAL.<\/p>\n<p>The guidance is: <strong>Always use UNIVERSAL profiles.<\/strong> There&#8217;s no reason to use any other kind. Another important consideration is, <strong>avoid using different kinds of authentication profile in the same environment<\/strong>. \u00a0If you mix different profile types, you can have 3 active profiles at the same time, like the example bellow.<\/p>\n<p><figure id=\"attachment_830\" aria-labelledby=\"figcaption_attachment_830\" class=\"wp-caption aligncenter\" ><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-mixed-authentication-profiles.png\" alt=\"Image pac mixed authentication profiles\" width=\"1351\" height=\"148\" class=\"size-full wp-image-830\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-mixed-authentication-profiles.png 1351w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-mixed-authentication-profiles-300x33.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-mixed-authentication-profiles-1024x112.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/12\/pac-mixed-authentication-profiles-768x84.png 768w\" sizes=\"(max-width: 1351px) 100vw, 1351px\" \/><figcaption id=\"figcaption_attachment_830\" class=\"wp-caption-text\">Authentication profiles<\/figcaption><\/figure><\/p>\n<p>In this scenario, you can have unexpected results because you have a DATAVERSE profile connected to the &#8220;Test&#8221; environment, and a UNIVERSAL profile connected to the &#8220;Personal Productivity&#8221; environment. It is hard to tell which profile a given command will use if you don&#8217;t explicitly specify an environment.<\/p>\n<h2>\ud83d\udd26 Summary<\/h2>\n<ul>\n<li>Always use UNIVERSAL kind for authentication profiles.<\/li>\n<li>Avoid having different authentication kinds in the same environment.<\/li>\n<li>Use &#8216;pac auth clear&#8217; if you want to clear all authentication profiles from your computer.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Good day developers! Power Platform CLI is a one stop command line interface to interact with Power Platform &#8211; aka PAC CLI. We have 3 different kinds of authentication profiles. In the version 1.16 of PAC CLI, we started to deprecate the parameter &#8211;kind and since then, UNIVERSAL is the default profile kind. In this [&hellip;]<\/p>\n","protected":false},"author":125432,"featured_media":902,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[11],"class_list":["post-810","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powerplatform","tag-cli"],"acf":[],"blog_post_summary":"<p>Good day developers! Power Platform CLI is a one stop command line interface to interact with Power Platform &#8211; aka PAC CLI. We have 3 different kinds of authentication profiles. In the version 1.16 of PAC CLI, we started to deprecate the parameter &#8211;kind and since then, UNIVERSAL is the default profile kind. In this [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/posts\/810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/users\/125432"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/comments?post=810"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/posts\/810\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/media\/902"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/media?parent=810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/categories?post=810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/tags?post=810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}