### List Installed Power Platform CLI Tools Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/prompt-wagon/README.md View a list of all tools currently installed with the Power Platform CLI. ```bash pac tool list ``` -------------------------------- ### Get Help on Power Platform CLI Tools Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/prompt-wagon/README.md This command provides assistance and information about the available tools within the Power Platform CLI. ```bash pac tool help ``` -------------------------------- ### Verify Azure CLI Installation Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/term-buddy/infra/infra-deployment.md Run this command in the VS Code terminal to check if the Azure CLI is installed correctly. ```bash az version ``` -------------------------------- ### Install Latest Power Platform CLI Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/prompt-wagon/README.md Use this command to install or update to the latest version of the Power Platform CLI. Ensure you have version 1.19.3 or newer. ```bash pac install latest ``` -------------------------------- ### Set Templates Variable and Navigate Screen Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/contoso-school/lab/manual.md This Power Fx command is used for the 'Start' button's OnSelect property. It runs the 'CreateTemplate' flow with user input from a text area, stores the results in a 'templates' variable, and navigates to 'Screen2'. ```powerfx Set(templates, CreateTemplate.Run(TextInput1.Text)); Navigate(Screen2, Push) ``` -------------------------------- ### Power Fx Named Formulas Example Source: https://context7.com/pnp/powerplatform-samples/llms.txt Demonstrates the use of Named Formulas in Power Fx for defining reactive data structures. These formulas are calculated once and recalculated as needed, serving as a declarative data model. ```yaml # From samples/a-puzzle-a-day — App.fx.yaml (conceptual excerpt) # Named Formula: board canvas with coordinates nfCanva = ForAll( Sequence(7, 1) As row, ForAll( Sequence(7, 1) As col, { row: row.Value, col: col.Value, title: row.Value & "-" & col.Value } ) ) ``` -------------------------------- ### Create Sample Folder Structure Source: https://context7.com/pnp/powerplatform-samples/llms.txt Set up the necessary directories for your sample, including solution, source code, and assets. ```bash mkdir -p samples/my-cool-sample/solution mkdir -p samples/my-cool-sample/sourcecode mkdir -p samples/my-cool-sample/assets ``` -------------------------------- ### Import Sample Solution via Power Apps Studio Source: https://context7.com/pnp/powerplatform-samples/llms.txt Instructions for importing a pre-built solution zip file into a Power Platform environment using Power Apps Studio. ```text 1. Download the solution .zip: samples//solution/.zip 2. Open https://make.powerapps.com → Solutions → Import Solution → Browse → select the .zip → Next → Import ``` -------------------------------- ### Add Sample Files and Commit Source: https://context7.com/pnp/powerplatform-samples/llms.txt Stage the new sample files and commit them with a descriptive message. ```bash git add samples/my-cool-sample/ git commit -m "Add my-cool-sample: brief description of what it does" ``` -------------------------------- ### Launch Configuration Migration Tool Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/prompt-wagon/README.md This command downloads and launches the Configuration Migration Tool, which is used for importing sample data into Dataverse. ```bash pac tool CMT ``` -------------------------------- ### Embed Power App in SharePoint Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/sharepoint-followsites/README.md Use this iframe code to embed the Power App into a SharePoint page. Replace the GUID with your App ID and adjust dimensions as needed. ```html ``` -------------------------------- ### Initialize Local Git Repository Source: https://github.com/pnp/powerplatform-samples/blob/main/CONTRIBUTING.md Use these commands to create a new local directory for the powerplatform-samples repository and initialize it as a Git repository. ```shell md powerplatform-samples cd powerplatform-samples git init ``` -------------------------------- ### Configure Serverless Compute Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/term-buddy/infra/infra-deployment.md Use the cheapest serverless compute with auto-shutdown after 20 minutes for Prompt Flow. ```markdown Use the cheapest serverless compute with auto shutdown after `20 minutes`. ``` -------------------------------- ### Gate Button Submission Based on Input Validation Source: https://context7.com/pnp/powerplatform-samples/llms.txt Control the `DisplayMode` of a button to enable submission only when all required input fields are valid. This example uses `IsValidEmail` and `IsValidPassword` UDFs. ```Power Fx # Usage in a Button's DisplayMode to gate submission: If( IsValidEmail(txtEmail.Text) And IsValidPassword(txtPassword.Text), DisplayMode.Edit, DisplayMode.Disabled ) ``` -------------------------------- ### Show Error Message for Invalid Input Source: https://context7.com/pnp/powerplatform-samples/llms.txt Control the visibility of an error label based on input validation results. This example uses `IsValidEmail` to show an error if the email input is not valid. ```Power Fx # Usage in a data card's Error label Visible property: Not(IsValidEmail(DataCardValue1.Text)) ``` -------------------------------- ### Deploy Budget Configuration Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/term-buddy/infra/infra-deployment.md Optionally deploy budget configurations using a Bicep template. Ensure all placeholder values are replaced with your specific details. ```bash az deployment sub create --name --location francecentral --template-file ".\code\budget.bicep" --parameters startDate= endDate= contactEmails='["", ""]' budgetName= amount= ``` -------------------------------- ### Clone Power Platform Samples Repository Source: https://context7.com/pnp/powerplatform-samples/llms.txt Clone your fork of the repository and navigate into the directory. ```bash git clone https://github.com/YOUR-GITHUB-USERNAME/powerplatform-samples.git cd powerplatform-samples ``` -------------------------------- ### Pack Power Apps Solution using Power Apps CLI Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/badgerfx/README.md Use the Power Apps CLI to pack source files back into a .zip file for solution deployment. Ensure the --processCanvasApps flag is used. ```bash pac solution pack --folder pathtosourcefolder --zipfile pathtosolution --processCanvasApps ``` -------------------------------- ### Pack Solution with Power Apps CLI Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/editable-subgrid/README.md Use the Power Apps CLI to pack source files back into a .zip file for solution deployment. Ensure you specify the correct folder and output file paths. ```bash pac solution pack --folder pathtosourcefolder --zipfile pathtosolution --processCanvasApps ``` -------------------------------- ### Deploy Core Infrastructure Resources Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/term-buddy/infra/infra-deployment.md Launch the core resource deployment using a Bicep template. Ensure all parameters, including IDs and names, are correctly specified. ```bash az deployment group create --resource-group --template-file ".\code\template.bicep" --parameters name= deploymentPrincipalId= aiHubFriendlyName='AI Hub: Term Buddy' aiProjectFriendlyName='AI Project: Term Buddy' aiHubDescription='Azure AI Hub for the Term Buddy.' tags='{"project": "term-buddy"}' ``` -------------------------------- ### Pack Power Apps Solution using CLI Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/clock-time-picker-component/README.md Use the Power Apps CLI to pack the source code into a solution zip file. Ensure you replace the placeholder paths with your actual source and destination file paths. ```bash pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder ``` -------------------------------- ### Copy and Fill README Template Source: https://context7.com/pnp/powerplatform-samples/llms.txt Copy the README template and fill in the required details for your sample. ```bash cp templates/sample-template/README.md samples/my-cool-sample/README.md # Edit README.md: title, summary, applies-to badges, prerequisites, version history ``` -------------------------------- ### Log in to Azure CLI Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/term-buddy/infra/infra-deployment.md Authenticate with your Azure tenant. Replace `` with your actual Azure Tenant ID. ```bash az login --tenant ``` -------------------------------- ### Pull Forked Repository Source: https://github.com/pnp/powerplatform-samples/blob/main/CONTRIBUTING.md After initializing your local repository, pull your forked copy of the powerplatform-samples repository to your local machine. ```shell git remote add origin https://github.com/yourgitaccount/powerplatform-samples.git git pull origin main ``` -------------------------------- ### Create Feature Branch for New Sample Source: https://context7.com/pnp/powerplatform-samples/llms.txt Create a new branch for your sample, named descriptively, based on the main branch. ```bash git checkout -b my-cool-sample main ``` -------------------------------- ### Contributing a New Sample - Git Workflow Source: https://context7.com/pnp/powerplatform-samples/llms.txt Follow these steps to contribute a new sample to the repository: fork the repo, create a new branch for your solution, adhere to sample structure guidelines, and submit a pull request targeting the 'main' branch. ```bash # 1. Fork https://github.com/pnp/powerplatform-samples on GitHub ``` -------------------------------- ### Pack Power Apps Source Code with Power Apps CLI Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/accessibility-color-contrast-checker/README.md Use the Power Apps CLI to pack the source files back into an .msapp file. Ensure you replace the placeholder paths with your actual folder locations. ```bash pac canvas pack --sources pathtosourcefolder --msapp pathtomsapp ``` -------------------------------- ### Add External Project as Git Subtree Source: https://github.com/pnp/powerplatform-samples/blob/main/CONTRIBUTING.md Integrate an existing GitHub project into the 'samples' folder of your local powerplatform-samples repository using the git subtree add command. Replace YOUR-SOLUTION-NAME with the actual name of your solution. ```shell git subtree add --prefix=samples/YOUR-SOLUTION-NAME https://github.com/yourgitaccount/YOUR-SOLUTION-NAME.git main ``` -------------------------------- ### Clone Solution to Source Files with Power Platform CLI Source: https://context7.com/pnp/powerplatform-samples/llms.txt Extracts a live solution from a Power Platform environment into version-controllable source files using 'pac solution clone'. This is essential for preparing new samples for contribution. ```bash # List all solutions in the connected environment pac solution list # Clone solution to a local sourcecode folder, unpacking Canvas Apps pac solution clone \ --name YourSolutionInternalName \ --outputDirectory ./samples/your-sample-name/sourcecode \ --processCanvasApps # After cloning, the sourcecode/ folder will contain: # ├── src/ # │ ├── CanvasApps/ # .msapp files unpacked to yaml/json # │ ├── Workflows/ # Power Automate flow definitions # │ └── Other/ # Solution.xml, Customizations.xml # └── YourSolution.cdsproj ``` -------------------------------- ### Pack Power Apps Source Code to Solution Zip Source: https://github.com/pnp/powerplatform-samples/blob/main/samples/apptemplate/README.md Use the Power Apps CLI to pack the source code files into a solution zip file. Ensure you replace the placeholder paths with your actual source and destination file paths. ```bash pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder --processCanvasApps ``` -------------------------------- ### Pack Canvas App MSAPP File with Power Platform CLI Source: https://context7.com/pnp/powerplatform-samples/llms.txt Rebuilds an .msapp file directly from source files for older canvas-only samples that are not wrapped in a solution, using the 'pac canvas pack' command. ```bash # Pack canvas app source files into .msapp pac canvas pack \ --sources ./samples/accessibility-color-contrast-checker/sourcecode \ --msapp ./samples/accessibility-color-contrast-checker/solution/ColorContrastRatio.msapp # Import the .msapp in Power Apps Studio: # File → Open → Browse → select ColorContrastRatio.msapp → Save & Publish ``` -------------------------------- ### Clone Power Platform Solution Source: https://github.com/pnp/powerplatform-samples/wiki/How-to-submit-a-Power-Platform-sample Use this command to clone a Power Platform solution, extracting its components into a specified output directory. The `--processCanvasApps` flag is crucial for unpacking canvas apps. ```bash pac solution clone --name InternalSolutionName --outputDirectory sourcecode --processCanvasApps ``` -------------------------------- ### Power Automate: Podcast Copilot Social Media Post Generation Source: https://context7.com/pnp/powerplatform-samples/llms.txt This flow generates social media blurbs and image URLs for podcasts. It's triggered by Copilot Studio and uses a Custom Connector that leverages Azure OpenAI services (Whisper, GPT-4, DALL-E). ```powerautomate Trigger: When Power Virtual Agents calls a flow Inputs: - podcastURL (String) Action: PodcastCopilot_Connector — Generate Social Media Post - podcastUrl: triggerBody()?['podcastURL'] Action: Return value(s) to Power Virtual Agents - Blurb: body('Generate_Social_Media_Post')?['blurb'] - ImageURL: body('Generate_Social_Media_Post')?['imageUrl'] # The Custom Connector backend (C# / .NET) executes: # 1. GET podcast feed → extract audio URL # 2. Azure OpenAI Whisper → transcribe audio to text # 3. GPT-4 → extract guest name from transcript # 4. Bing Search API → fetch guest biography # 5. GPT-4 → generate social media blurb from transcript + bio # 6. GPT-4 → generate DALL-E prompt from blurb # 7. DALL-E 3 → generate promotional image # Returns: { blurb: "...", imageUrl: "https://..." } ``` -------------------------------- ### Pack Source Code to Solution ZIP with Power Platform CLI Source: https://context7.com/pnp/powerplatform-samples/llms.txt Rebuilds a deployable solution zip file from unpacked source code using the 'pac solution pack' command. This is necessary for modifying source files before import or for submitting contributions. ```bash # Install Power Platform CLI via VS Code extension or npm: # https://aka.ms/pac/docs#install-using-power-platform-tools-for-visual-studio-code # Authenticate to a Power Platform environment pac auth create --url https://yourorg.crm.dynamics.com # Verify connected environment pac org who # Pack source files back into a solution zip pac solution pack \ --zipfile ./samples/a-puzzle-a-day/solution/a-puzzle-a-day.zip \ --folder ./samples/a-puzzle-a-day/sourcecode \ --processCanvasApps # Expected output: # Microsoft PowerApps CLI # Build: 1.x.x # Packing solution... # Solution packed to: ./samples/a-puzzle-a-day/solution/a-puzzle-a-day.zip ```