Replies: 2 comments 5 replies
-
Hi, in your case, you are connecting with a certificate, so only Application permissions will be used and Delegated permissions will be ignored. Use |
Beta Was this translation helpful? Give feedback.
-
I am trying to do this as an application ... we are running this under a Task Scheduler task and so not as a user ... i.e. there is no user login that prompts for credentials. This was working before Sept when the security settings changed ... and I believe we have the app permissions set as needed ... Am I doing something incorrectly? Thanks rene |
Beta Was this translation helpful? Give feedback.
-
Notice
Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:
Reporting an Issue or Missing Feature
In one of our PowerShell scripts (which runs as an automated task) we connect using the following to establish a connection (using App Reg $clientId) and the connection works fine:
Connect-PnPOnline ($tenantName + ".sharepoint.com") -ClientId $clientId -Tenant ($tenantName + ".onmicrosoft.com") -CertificatePath $certPath -CertificatePassword (convertto-securestring -String "xxxxxxxxxxx" -AsPlainText -Force)
However, once connected we then attempt to use Get-PnPFLow to access the flow instances in the environment using
Get-PnPFlow -Environment $environmentName -SharingStatus Personal -Verbose
Expected behavior
For Get-PnPFlow to return a list of flows (which used to work BEFORE Sept 9th when the security change related to PnP came out which required us to set up the App Registrations). Best we can tell our App Reg is set up correctly and the Connect-PnPOnline call does create a valid connection via the App Reg.
Actual behavior
We get this error:
Getting flows from Flow Env: Default-yyyyyyy-xxxx-xxxx-xxxx-yyyyyyyyybec
WARNING: This cmdlet is not available under application permissions
Get-PnPFlow: C:\KEEPit\FlowMonitor\FlowMonitor.ps1:261
Line |
261 | … $flows = Get-PnPFlow -Environment $environmentName -SharingStatus …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Make sure you have granted access to Azure AD App to Interact with Power Platform, To help understand the
| required permissions visit
| https://pnp.github.io/powershell/articles/determinepermissions.html#help-i-cant-figure-out-which-permissions-i-need
We have granted the App Reg full access to manage all flows in the environment.
Is there another permission needed? I tried running using the verbose option as suggested in #4353, but all it shows is:
Get-PnPFlow: Make sure you have granted access to Azure AD App to Interact with Power Platform, To help understand the required permissions visit https://pnp.github.io/powershell/articles/determinepermissions.html#help-i-cant-figure-out-which-permissions-i-need
Steps to reproduce behavior
Stripped down version of our code that results in the same behavior
#===========================================================================
$environmentName = "" #NNConnect --Set the PowerAutomate environment
$tenantName = "" #NNConnect Tenant
$clientId = "" #NNConnect App/Client ID
$certPath = "C:\certs\PnP PowerShell Tasks.pfx"
$trgtUrl = ""
try{
}catch [Exception]{
}
#Get reference to all the flows in the PowerAutomate environment
try{
}catch{
}
#Process the retrieved flows
$msg = ("Processing retrieved flows ... from env " + $environmentName + " (Found " + $flows.count + " flows)")
write-host $msg
foreach($flow in $flows){
}
exit
#===================================================================================
What is the version of the Cmdlet module you are running?
ModuleType Version PreRelease Name PSEdition ExportedCommands
Manifest 2.99.33 nightly PnP.PowerShell Desk {Add-PnPAdaptiveScopeProperty, Add-PnPE…
ModuleType Version PreRelease Name PSEdition ExportedCommands
Manifest 2.9.0 PnP.PowerShell Core {Add-PnPAdaptiveScopeProperty, Add-PnPE…
Manifest 2.4.0 PnP.PowerShell Desk {Add-PnPAdaptiveScopeProperty, Add-PnPE…
Manifest 1.12.0 PnP.PowerShell Core,Desk {Add-PnPAdaptiveScopeProperty, Add-PnPP…
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions