0

I am doing SP Online development with SPFx. I have some PnP Powershell scripts I want to run from azure, but I want the end user to be able to trigger it from a flow from triggers like an item create/update event.

I can create the flow, but the problem is, how is the authentication done for the PnP Powershell script? I want it to run as an account with full rights and not the end users rights.

What is the standard method for doing this? Do I create a service account without MFA and no password expiration policy and hardcode the credentials for the Connect-PnPOnline command?

1 Answer 1

0

Never use "service" accounts. They don't exist.

I would suggest looking at Azure Automation. You can leverage a Client ID/Secret or Certificate pattern after registering an Azure AD app with the permissions it requires. Azure Automation can be kicked off by a Power Automate flow (there are actions available for Azure Automation).

4
  • I found an article on this spmaestro.com/…, is this method what you would recommend?
    – omega
    Commented Dec 2, 2020 at 15:58
  • Yes, but ignore the section "Create Azure Automation Credentials". The author describes the CID/Secret method of creating the connection which is what you should use.
    – user6024
    Commented Dec 2, 2020 at 16:06
  • Can you explain more about it? So I should ignore the "Create Azure Automation Credentials" section, but use the other method. Where is this other method described, Im not sure which section you are referring to.
    – omega
    Commented Dec 2, 2020 at 16:13
  • The last section walks you through how to set up and use Client ID/Client Secret authentication - spmaestro.com/…
    – user6024
    Commented Dec 2, 2020 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.