{"id":247,"date":"2023-07-31T13:46:32","date_gmt":"2023-07-31T20:46:32","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powerplatform\/?p=247"},"modified":"2025-02-11T10:05:13","modified_gmt":"2025-02-11T18:05:13","slug":"getting-started-with-power-platform-cli-and-power-pages","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powerplatform\/getting-started-with-power-platform-cli-and-power-pages\/","title":{"rendered":"Getting Started with Power Platform CLI and Power Pages"},"content":{"rendered":"<p>In this blog, I will highlight the <code>pac paportal<\/code> command group that is part of the Power Platform CLI.<\/p>\n<blockquote>\n<p>This blog is part of a multi-part series on the Power Platform CLI.<\/p>\n<p>The following blogs appeared in this series:<\/p>\n<ul>\n<li><a href=\"\/powerplatform\/getting-started-with-the-power-platform-cli\/\">Part 1 &#8211; Getting Started with the Power Platform CLI<\/a><\/li>\n<li><a href=\"\/powerplatform\/streamline-your-solution-development-with-the-power-platform-cli-create-a-solution-from-scratch\/\">Part 2 &#8211; Streamline your solution development with the Power Platform CLI: Create a solution from scratch<\/a><\/li>\n<li>Part 3 &#8211; Getting Started with Power Platform CLI and Power Pages (This blog)<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/powerplatform\/create-multilingual-copilots-with-the-power-platform-cli-and-microsoft-copilot-studio\/\">Part 4 &#8211; Create multilingual copilots with the Power Platform CLI and Microsoft Copilot Studio <\/a><\/li>\n<\/ul>\n<\/blockquote>\n<h2>Overview of the &#96;pac paportal&#96; command group<\/h2>\n<p>There are multiple commands part of the <code>pac paportal<\/code> command group:<\/p>\n<ul>\n<li><code>pac paportal list<\/code> (<a href=\"https:\/\/aka.ms\/pac\/paportal\/#pac-paportal-list\">doc<\/a>) &#8211; This command helps you list Power Pages websites.<\/li>\n<li><code>pac paportal download<\/code> (<a href=\"https:\/\/aka.ms\/pac\/paportal\/#pac-paportal-download\">doc<\/a>) &#8211; This command helps you download a Power Pages website to a local directory.<\/li>\n<li><code>pac paportal upload<\/code> (<a href=\"https:\/\/aka.ms\/pac\/paportal\/#pac-paportal-upload\">doc<\/a>) &#8211; This command helps you upload a Power Pages website that you have stored locally.<\/li>\n<\/ul>\n<h2>\ud83d\udcc3 List your Power Pages websites<\/h2>\n<p>The first step when working with Power Pages websites in Power Platform CLI is using the <code>pac paportal list<\/code> command. This command lists all the Power Pages websites in the environment you are connected to. When there are one or more Power Pages websites in your environment, it will show a list of websites, with their names and Website Id&#8217;s.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/05\/pac-paportal-list.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/05\/pac-paportal-list-1024x273.png\" alt=\"Image pac paportal list\" width=\"640\" height=\"171\" class=\"alignnone size-large wp-image-255\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/05\/pac-paportal-list-1024x273.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/05\/pac-paportal-list-300x80.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/05\/pac-paportal-list-768x205.png 768w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/05\/pac-paportal-list.png 1192w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>As the next step you will have to download your Power Pages website.<\/p>\n<h2>\u2b07\ufe0f Download the Power Pages website<\/h2>\n<p>To download your Power Pages website, run the following command:<\/p>\n<p><code>pac paportal download -p \"Power Pages 101\" -id 93d922fb-61cd-ed11-b596-6045bd026056<\/code><\/p>\n<blockquote>\n<p>This command consists of the actual command <code>pac paportal download<\/code> and has two parameters.<br \/>\n  <code>-p<\/code> &#8211; This stands for path. You can add a directory name here, where Power Platform CLI will download the Power Pages website.<br \/>\n  <code>-id<\/code> &#8211; This is the ID of the website. In the example above, we use the Website Id we got from the <code>pac paportal list<\/code> command we ran before.<\/p>\n<\/blockquote>\n<p>When you run the command, you will get an information message at the start:<\/p>\n<p><code>Information:  \nBe careful when you're updating public sites. The changes you make are visible to anyone immediately. To check site visibility, go to https:\/\/make.powerpages.microsoft.com\/.\nTo get additional information, please visit [https:\/\/go.microsoft.com\/fwlink\/?linkid=2204350](https:\/\/go.microsoft.com\/fwlink\/?linkid=2204350)<\/code><\/p>\n<p>This means that you must be careful with public sites. Only update a production site when you&#8217;re sure the changes are correct. This will take about ~30 seconds based on your internet connection. When it&#8217;s done, the directory <code>Power Pages 101<\/code> is downloaded locally.<\/p>\n<h2>\ud83d\udee0\ufe0f Make some changes to the Power Pages website locally<\/h2>\n<p>Change the directory to the <code>Power Pages 101<\/code> directory by using the command <code>cd 'Power Pages 101'<\/code>. Next, use the following command to open the current folder in VS Code:<\/p>\n<p><code>code .<\/code><\/p>\n<p>If you encounter an error, it might be that VS Code is not added to your path. See <a href=\"https:\/\/www.jamesqquick.com\/blog\/add-vs-code-to-your-path\/\">this blog<\/a> by James Quick to learn how you can add VS Code to your path.<\/p>\n<h3>\ud83e\uddd1\u200d\ud83d\udcbb Open the website in VS Code<\/h3>\n<p>Now we have the <code>Power Pages 101<\/code> directory open in VS Code, let&#8217;s change something in the Power Pages website! In VS Code, you will notice that the Power Platform CLI downloaded a lot of files and folders. Let&#8217;s expand the main folder called <code>power-pages-101---powerpages101<\/code> (or if you named your website different, it would have a different name), expand <code>web-pages<\/code>, expand <code>home<\/code>, expand <code>content pages<\/code> and finally select <code>Home.en-US.webpage.copy.html<\/code>. This is the homepage HTML.<\/p>\n<h3>\ud83d\udd04 Update the homepage with Liquid code<\/h3>\n<p>Find the following HTML code:<\/p>\n<pre><code class=\"html\">&lt;h2 style=\"text-align: center;\"&gt;Introduction section&lt;\/h2&gt;\n&lt;p style=\"text-align: center;\"&gt;Create a short paragraph that shows your target audience a clear benefit to them if they continue past this point and offer direction about the next steps&lt;\/p&gt;\n<\/code><\/pre>\n<p>Inside of the paragraph tag, and before the C of Create add the following Liquid code:<\/p>\n<pre><code class=\"html\">{% if user %}\nHello, {{ user.fullname | escape }}!\n{% else %}\nHello, anonymous user!\n{% endif %}\n&lt;\/br&gt;\n<\/code><\/pre>\n<h4>Dynamic Liquid code<\/h4>\n<p>The Liquid code above will make sure that a logged in user will see <code>Hello, {{User Full Name}}<\/code> where <code>{{User Full Name}}<\/code> will be replaced by the full name of the user and an anonymous user will see <code>Hello, anonymous user!<\/code><\/p>\n<p>Liquid is a template language you can use in Power Pages to make your website more dynamic. <a href=\"https:\/\/learn.microsoft.com\/en-us\/power-pages\/configure\/liquid\/liquid-overview\">Learn more<\/a> about Liquid in Power Pages on Microsoft Learn.<\/p>\n<h4>End result<\/h4>\n<p>If everything goes well, the paragraph tag should look like this now:<\/p>\n<pre><code class=\"html\">&lt;p style=\"text-align: center;\"&gt;\n{% if user %}\nHello, {{ user.fullname | escape }}!\n{% else %}\nHello, anonymous user!\n{% endif %}\n&lt;\/br&gt;Create a short paragraph that shows your target audience a clear benefit to them if they continue past this point and offer direction about the next steps&lt;\/p&gt;\n<\/code><\/pre>\n<p>Save the webpage.<\/p>\n<h2>\u2b06\ufe0f Upload the changes to the Power Pages website<\/h2>\n<p>Now the changes are applied, let&#8217;s upload the website and see how it looks!<\/p>\n<p>Update the path parameter (if needed) in the following command and run it to update the Power Pages website:<\/p>\n<p><code>pac paportal upload --path .\/power-pages-101---powerpages101\/<\/code><\/p>\n<p>This takes around 10 seconds, but it will update only the changed files. Go to the website and check out the website as an anonymous user:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Anonymous-1024x535.png\" alt=\"Power Pages website with the highlighted and magnified greeting 'Hello, anonymous user!'\" width=\"640\" height=\"334\" class=\"size-large wp-image-397\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Anonymous-1024x535.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Anonymous-300x157.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Anonymous-768x401.png 768w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Anonymous-1536x802.png 1536w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Anonymous-2048x1070.png 2048w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Log in and check out the website as a logged in user as well:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Logged-In-1024x535.png\" alt=\"Power Pages website with the highlighted and magnified greeting 'Hello, Daniel Laskewitz!'\" width=\"640\" height=\"334\" class=\"size-large wp-image-401\" srcset=\"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Logged-In-1024x535.png 1024w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Logged-In-300x157.png 300w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Logged-In-768x401.png 768w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Logged-In-1536x802.png 1536w, https:\/\/devblogs.microsoft.com\/powerplatform\/wp-content\/uploads\/sites\/79\/2023\/07\/Intro-Logged-In-2048x1070.png 2048w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>As you can see, it is a breeze to update Power Pages websites with Power Platform CLI. In the future, I will blog about how to handle multiple websites instead of just one so stay tuned and <a href=\"https:\/\/devblogs.microsoft.com\/powerplatform\/#subscribe_form\">subscribe<\/a> to the blog to get the latest updates!<\/p>\n<h2>\ud83d\udcfa Power Platform CLI Exposed Power Pages<\/h2>\n<p>In one of the <a href=\"https:\/\/www.youtube.com\/playlist?list=PLlrxD0HtieHhEdLHxQOU96ySSZpMCyAxf\">Power Platform CLI Exposed<\/a> episodes, Nick Doelman shows me how the Power Pages commands work! Check out the video below!<\/p>\n<p><iframe title=\"Power Platform CLI Exposed: Power Pages\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/V8xlGf9JiF8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, I will highlight the pac paportal command group that is part of the Power Platform CLI. This blog is part of a multi-part series on the Power Platform CLI. The following blogs appeared in this series: Part 1 &#8211; Getting Started with the Power Platform CLI Part 2 &#8211; Streamline your solution [&hellip;]<\/p>\n","protected":false},"author":115431,"featured_media":254,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[5,36,11],"class_list":["post-247","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powerplatform","tag-powerpages","tag-power-platform","tag-cli"],"acf":[],"blog_post_summary":"<p>In this blog, I will highlight the pac paportal command group that is part of the Power Platform CLI. This blog is part of a multi-part series on the Power Platform CLI. The following blogs appeared in this series: Part 1 &#8211; Getting Started with the Power Platform CLI Part 2 &#8211; Streamline your solution [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/posts\/247","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\/115431"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/comments?post=247"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/posts\/247\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/media\/254"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/media?parent=247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/categories?post=247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powerplatform\/wp-json\/wp\/v2\/tags?post=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}