Cloud Flows are disabled or turned off after copying a Dataverse Environment ? (Power Automate / Power Platform)


Recently we copied our UAT environment to one of the testing environments. After copying, we saw that all the cloud flows were in Off / Disabled state.

A screenshot of a computer

Description automatically generated

This was because during copy the environment is set in administration mode and background operations are also disabled.

Flows are automatically turned off to prevent –

  • Accidental execution of automation in a copied/test environment
  • Potential integration issues due to different connectors or authentication.
  • Unintended data modifications (e.g., flows interacting with external systems like SharePoint, SQL, or APIs).

If required, we can disable the administration mode or at least enable the background operations.

A screenshot of a computer

Description automatically generated

However, the flows will not automatically switch On even if we enable either the Administration Mode or Background operations.

Here we need to switch them On manually or use PowerShell scripts or API to do so.

Refer to blog posts for details on it –

PowerShell https://www.syskit.com/blog/managing-microsoft-powerapps-and-flow-like-a-pro-part-3-managing-flows/

Console App / APIhttps://nishantrana.me/2024/06/12/enable-disable-turn-on-turn-off-multiple-cloud-flows-using-code-power-automate/

Additional Considerations –

Connection References: If the flows use connection references (like SharePoint, Dataverse, Outlook, etc.), we need to verify them in Solution > Connection References and update them if necessary.

Environment Variables: If the flows depend on environment variables (e.g., API URLs, credentials), we need to update them the new environment.

Reassign Flow Owners: If the original owner of a flow is missing from the copied environment, we need to assign a new owner.

Lastly, if flows are not behaving correctly, check the callback registration records

https://nishantrana.me/2024/06/11/fixed-flow-not-getting-triggered-callback-registration-power-automate-dataverse/

Get more details around copying the environment.

Hope it helps..

Advertisements

How to configure Site.Selected API permissions – SharePoint Online / PnP PowerShell


Let us add/ update the API Permissions for the App

More on registering App – https://nishantrana.me/2024/07/30/calling-sharepoint-online-api-using-azure-ad-app-only-permissions-using-certificate-auth/

Here we have selected the Sites.Selected permission.

A screenshot of a computer

Description automatically generated

Also granted the Admin consent.

A screenshot of a computer

Description automatically generated
A screenshot of a computer

Description automatically generated

Now if we run our code we will get the 403 Forbidden error.

This is because we have selected the Sites.Selected permission, but have not specified the site and the permission.

For that, we can use either Graph API or PnP PowerShell.

Let us use PnP PowerShell here.

Grant-PnPAzureADAppSitePermission -AppId “{app-id}” -DisplayName “{app-name}” -Site “https://{tenant}.sharepoint.com/sites/{site-name}” -Permissions “Write”

Grant-PnPAzureADAppSitePermission -AppId “d7eaeeb7-ef0a-474d-9b94-567013576c14” -DisplayName “SharePointApp” -Site “https://w72tk.sharepoint.com/sites/MyTeamSite” -Permissions “Write”

A computer screen with text and arrows

Description automatically generated

This time as expected we do not get the Forbidden error.

The other Permissions that we can specify are – Read, Manage, FullControl.

Get all the details here –https://pnp.github.io/powershell/cmdlets/Grant-PnPAzureADAppSitePermission.html

Hope it helps..

Advertisements

Fixed – The term ‘Connect-PnPOnline’ is not recognized as the name of a cmdlet, function, script file, or operable program – PowerShell


If you are getting the below error even after running the Install-Module PnP.PowerShell command, it could be because of the older version of PowerShell.

The minimum PowerShell version required for PnP.PowerShell is PowerShell 7.2.

Check the current version using the command – $PSVersionTable

A computer screen shot of a program

Description automatically generated

Below are different ways to get the latest version of PowerShell

https://learn.microsoft.com/en-gb/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4

Here we have used the Winget (Windows Package Manager) tool to install it.

winget search Microsoft.PowerShell

winget install –id Microsoft.Powershell –source winget

A screenshot of a computer

Description automatically generated

We can see the PowerShell 7 installed.

Now we can install the PnP.PowerShell module and connect to our site successfully.

A computer screen with text

Description automatically generated

https://evolvous.com/learn-from-expert/how-to-install-pnp-powershell-and-connect-with-sharepoint-online/

1–2 minutes

Hope it helps..

Advertisements

How to – Connect to Exchange Online to get mailbox details (PowerShell)


Recently we were trying to figure out a few details about the user’s mailbox.

To get the details –

Open Windows PowerShell with the “Run as Administrator” option.

  • Install the Exchange Online Module – Install-Module -Name ExchangeOnlineManagement
  • Import the Exchange Online Module cmdlets – Import-Module ExchangeOnlineManagement
  • Connect to Exchange Online using the administrator account – Connect-ExchangeOnline

  • To get a summary of the all mailboxes in the organization – Get-Mailbox -ResultSize unlimited

  • To get specific mailbox details – Get-Mailbox -Identity “user1@2022rw1.onmicrosoft.com”

  • To get the complete detail of a mailbox – Get-Mailbox -Identity user1@2022RW1.onmicrosoft.com | Format-List

Get all the details here – https://learn.microsoft.com/en-us/powershell/module/exchange/get-mailbox?view=exchange-ps

Hope it helps..

Advertisements