Unattended Flows

Scenario

In this lab, you will deploy the solution to run unattended flows in a new test environment.

High-level lab Objectives

  • Configure VM for unattended execution

  • Configure a machine group

  • Create and configure an Azure Key Vault

  • Use Key Vault in automations

  • Configure and use environment variables

  • Transport the solution from dev to test

Exercise #1: Configure VM

In this exercise, you will configure the Virtual Machine.

Task #1: Configure VM

  1. Go to your Azure portal https://portal.azure.com/, go to Virtual machines and and open the Funding virtual machine.

select the vm described

  1. Click the Connect button.

connect button

  1. Select Download RDP File. Select Keep to download the file and launch the remote desktop connection file.

  2. Select Use a different account if needed, enter Funding for Username, enter the password you created in lab00, and click OK.

Sing in to VM

  1. If prompted, click Yes to connect anyway and complete the setup.

  2. On the VM, open the Microsoft Store app and go to Library.

Select My Library from the three dots menu

  1. Locate Power Automate in the list and select Open.

  2. Wait while any updates are installed.

  3. Launch Power Automate provide your Power Platform admin login credentials and Sign in to Power Automate Desktop.

  4. Go to Settings and under Machine settings select Open machine settings.

  5. Select the Install app button.

  6. On the installer, check the box to agree to the terms of use then select the Install button.

  7. Select Launch app.

  8. On the Machine settings section, select the Machine environment dropdown and select your Test environment.

  9. Click Change.

select as described

  1. Select the Machine group tab.

  2. Click + New machine group.

  3. Enter Funding for Machine group name and click Create.

  4. Click on the Funding machine group you created.

  5. Click Add machine.

  6. Click Add machine again.

  7. Click Got it.

  8. You should now see the Joined machine group with one machine.

review the results of the prior steps

  1. Go to your Local computer and copy the Labs folder located in your C:\ drive.

image of file explorer

  1. Go back to the Remote desktop and open file explorer.

  2. Browse to C:\ and paste the Labs folder you copied. This folder must be in the same location on both computers.

image of file explorer

  1. Browse to C:\Labs\Resources\Funding manager app and launch the Woodgrove Bank Funding Manager.exe app. If prompted, download .NET and install. Then try to launch Woodgrove Bank Funding Manager.exe again.

Screenshot showing the Woodgrove Bank Funding Manager.exe file

  1. The app should install and launch. Close the application.

  2. Launch Microsoft Edge.

  3. Click Settings and select Extensions.

menu in Microsoft Edge

  1. Click Open Microsoft Edge Add-ons website.

select as described

  1. Search for Power Automate extensions and click to open Microsoft Power Automate.

select as described

  1. Click Get or turn it on if already installed.

Exercise #2: Key Vault

In this exercise, you will create a Key Vault.

Task #1: Create Key Vault

  1. In your Local machine, go to your Azure portal.

  2. Click Subscriptions.

select as described

  1. Open the subscription.

  2. Select Resource providers.

  3. Search for Microsoft.PowerPlatform and select it.

  4. Click Register.

select as described

  1. Click Home.

  2. Click + Create a resource.

  3. Search for key vault and select Key Vault.

select as described

  1. Click Create.

  2. Select Funding for Resource group, type FundingFL (Replace FL with your initials) for Key vault name and select Review + create.

review the results of the prior steps

  1. Review the values and select Create.

  2. Wait for the deployment to complete.

  3. Select Go to resource.

select as described

  1. Select Access controm (IAM).

  2. Click + Add and select Add role assignment.

Add role assignment

  1. Select Key Vault Administrator and then Members tab.

Members tab

  1. Click + select members

  2. Select your username and then click Select.

  3. Click Review + assign

  4. Click Review + assign again.

  5. Click + Add and select Add role assignment again.

  6. Select Key Vault Secret User and then Members tab.

  7. Click + select members.

  8. Search for dataverse and select Dataverse.

Dataverse

  1. Click Select.

  2. Click Review + assign.

  3. Click Review + assign again.

  4. Select Secrets and then + Generate/Import.

select as described

  1. Enter FundingPassword for Name, enter pass@word1 for Value, and select Create.

select and complete as described

Exercise #3: Environment Variables

In this exercise, will create environment variables and use them in the flows.

Task #1: Create environment variables

  1. In your Local machine, navigate to https://make.powerapps.com/ and make sure you are in your Dev environment.

  2. Select Solutions and open the Construction Funding solution.

  3. Click + New and select More | Environment variable.

select as described

  1. Enter Funding Run Mode for Display name, select Text for Data type, enter Unattended for Default value, go to the Current value section, and click + New value.

select as described

  1. Enter Attended and click Save.

  2. Select environment variables and click to open variable you just created.

select as described

  1. Click on the button of the Current value and select Remove from this solution. We are removing the value from the solution, so it won’t move to test/production.

select as described

  1. Close the edit pane.

  2. Click + New and select More | Environment variable again.

  3. Enter Funding Password for Display name, select Secret for Data type, enter secretid for Default value, select Azure Key Vault for Secret Store, and click + New Azure Key Vault secret reference.

select as described

  1. DO NOT navigate away from this page. Start a new browser window or tab and navigate to your Azure portal.

  2. Click to open the FundingFL Key Vault you created. Remember the name of the Key Vault (FL will be your initials)

  3. Copy the Subscription ID.

select as described

  1. Go back to the environment variable and paste it in the Azure subscription Id field.

paste as described

  1. Enter Funding for Resource group name, FundingFL (FL will be your initials) for Azure Key Vault name, and FundingPassword for Secret name. These values must match what you used or you will see an error at the top of the panel.

select as described and review results of the prior steps

  1. Click Save again.

  2. Select Environment variables and open the Funding Password variable you just created.

  3. Click on the button of the current value and select Remove from this solution.

select as described

  1. Close Edit pane.

  2. Select Cloud flows, select the CF Manage Inspection Process flow, and click Edit.

  3. Expand the Run a flow built with Power Automate for desktop step.

  4. Click on the Run Mode dropdown and select Custom Value.

select as described

  1. Select the Funding Run Mode environment variable from the dynamic content pane. This will allow us to determine if the desktop flow runs attended or unattended in each environment the solution is imported into.

  2. Click Save and wait for the flow to be saved.

  3. Click on the back button.

  4. Select Cloud flows, select the CF Manage Woodgrove Funding Process flow, and click Edit.

  5. Expand the Run a flow built with Power Automate for desktop step.

  6. Click on the Run Mode dropdown and select Enter custom value.

select as described

  1. Select the Funding Run Mode environment variable from the dynamic content pane.

  2. Click the + Insert a new step after the trigger and select Add an action.

  3. Select the Perform an unbound action action from the Microsoft Dataverse connector.

select as described

  1. Select RetrieveEnvironmentVariableSecretValue for Action name, enter rc_FundingPassword for EnvironmentVariableName, click on the Menu button, and select Settings.

select as described

  1. Turn on Secure Outputs and click Done. This ensures the value is not visible when someone views the run details after execution.

select as described

  1. Expand the Run a flow built with Power Automate for desktop step again.

  2. Remove the current Password value and select RetrieveEnvironmentVariableSecretValueResponse from the dynamic content pane.

select as described

  1. Click on the Menu button and select Settings.

  2. Turn on Secure Inputs and click Done.

  3. Click Save and wait for the flow to be saved.

Exercise #4: Export Solution

In this exercise, will export the Builder Risk Service and the Construction Funding solutions.

Task #1: Export solution

  1. In your Local machine, navigate to https://make.powerapps.com/ and make sure you are in your Dev environment.

  2. Select Solutions, select the Builder Risk Service solution and click Export solution.

select as described

  1. Click Publish and wait for the publishing to complete.

  2. Click Next.

  3. Select Managed and click Export.

select as described

  1. Wait for the export to complete and click Download.

  2. Select the Construction Funding solution and click Export solution.

  3. Click Publish and wait for the publishing to complete.

  4. Click Next.

  5. Select Managed and click Export.

  6. Wait for the solution to be exported.

  7. Click Download.

  8. Click to open the Construction Funding solution.

select as described

  1. Select Cloud flows, select the Process Construction Funding Request flow and click Turn Off. We are doing this simply so we can use the same shared email for testing, in a real solution you would use separate mailboxes for dev/test/production.

select as described

Exercise #5: Import Solution

In this exercise, will import the Builder Risk Service and Construction Funding solutions and test the flows.

Task #1: Import solution

  1. Select your Test environment.

  2. Select Solution and click Import solution.

  3. Click Browse.

  4. Select the BuilderRiskService_1_0_0_1_managed.zip solution you exported and click Open.

  5. Click Next.

  6. Click Import and wait for the import to complete.

  7. Click Import solution again.

  8. Click Browse.

  9. Select the ConstructionFunding_1_0_0_1_managed.zip solution you exported and click Open.

  10. Click Next.

  11. Click Next again.

  12. Click on the drop down for the Builder Risk Service connection and select + New connection.

select as described

  1. DO NOT navigate away from this page. Start a new browser window or tab and navigate to https://adatumbuilderrisktest.azurewebsites.net/

  2. Click on the API Key link.

  3. Copy the API Key.

select as described

  1. Go back to the Builder Risk Service connection, paste the API Key you copied and click Create.

  2. Close the connections browser tab or window.

  3. Click Refresh.

select as described

  1. Click on the Office 365 connection dropdown and select + New connection.

  2. Click Create.

  3. Select your credentials.

  4. Close the connections browser tab or window.

  5. Click Refresh.

  6. Click on the Desktop flows connection dropdown and select + New connection.

  7. Enter Funding for Domain and username, enter the password you created in lab00, and click Create.

select as described

  1. Close the connections browser tab or window.

  2. Click Refresh.

  3. Click on the Dataverse connection dropdown and select + New connection.

  4. Click Create.

  5. Select your credentials.

  6. Close the connections browser tab or window.

  7. Click Refresh.

  8. Click Next.

select as described

  1. DO NOT navigate away from this page. Start a new browser window or tab and navigate to your Azure portal.

  2. Click to open the Key Vault.

select as described

  1. Copy the Subscription ID. For this lab you will use the same subscription you used for the Dev. Usually, you would create a different subscription for Dev, Test, and Production.

select as described

  1. Paste the text below in the Funding Password field. Replace [SubscriptionID] with subscription id you copied and replace [FL] with your initials.

/subscriptions/[SubscriptionID]/resourceGroups/Funding/providers/Microsoft.KeyVault/vaults/Funding[FL]/secrets/FundingPassword

  1. Click Import and wait for the import to complete.

select as described

  1. Import should succeed. Note: If it takes more than five minutes to import, check History to see if it failed. If you didn’t have the correct Key Vault information this can occur.

select as described

  1. Publish all customizations and wait for the publishing to complete.

  2. Click to open the Construction Funding solution.

  3. Select Cloud flows and open the Create Test Data flow.

select as described

  1. Click Run.

  2. Click Run flow.

  3. Click Done.

  4. Wait for the run to complete.

  5. Select the Process Construction Funding Request cloud flow and turn it on if it not already turned on.

Task #2: Test

  1. Go to your remote desktop and Sign out. Make sure you choose sign out and not disconnect as unattended flows won’t run when you are signed in.

select as described

  1. Go to the resources folder of the lab and open the Test folder.

  2. You will attach the Attachment AI Test file when you send the email.

select the file for testing

  1. Send an email to Funding@yourdomain.onmicrosoft.com make sure the subject of the email is MC3747 and you attach the Attachment AI Test.pdf file.

  2. Navigate to https://make.powerapps.com/ and make sure you have the Test environment selected.

  3. Select Solutions and click to open the Construction Funding solution.

  4. Select Cloud flows and open the Process Construction Funding Request flow.

  5. Review the 28-day run history.

  6. You should see a flow run with a Status of Running. Select the timestamp to open the flow run details.

  7. Wait for the flow run to complete.

  8. The flow run should succeed, and you should get an email back with the Subject line Draw approved.

review the results of the prior steps