cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pbnet
New Member

Cannot get parameters from Azure Runbook in PowerAutomate

Hello,

I'm trying to automate some SharePoint site creations with Azure Runbooks and PowerAutomate.

Basically, when an item is created in a SharePoint list, create a site based on a PNP Template. 

In Azure, I've setup the following PowerShell runbook:

 

#Dynamic parameters to pass to PowerAutomate
param(
    [Parameter](Mandatory=$true)][string]$SiteTemplateURL
    [Parameter](Mandatory=$true)[string]$ApplyTemplatetoURL
)
#Credentials
$myCred = Get-AutomationPSCredential -Name "SPOAdminCred"

Connect-PnPOnline -url $SiteTemplateURL -Credentials $myCred
#Create new Site
New-PnPWeb -Title "This PNP Test 1" -Url $ApplyTemplatetoURL -Description "This is a test for PNP templates" -Locale 1033 -Template "STS#3"

Connect-PnPOnline https://andreir2020.sharepoint.com/sites/Blabla/$ApplyTemplatetoURL -Credentials $myCred

 
The problem is that I cannot get the parameters in PowerAutomate
 
PAQuestion.PNG
I should get 2 parameters, not one in the create job step. 
 
Thanks for any help.
1 ACCEPTED SOLUTION

Accepted Solutions
pbnet
New Member

OK, solved it:

 

#Dynamic parameters to pass to PowerAutomate
param(
    [Parameter(Mandatory=$true)]
    [string]$SiteTemplateURL,
    [Parameter(Mandatory=$true)]
    [string]$ApplyTemplatetoURL
)
#Credentials
$myCred = Get-AutomationPSCredential -Name "SPOAdminCred"

Connect-PnPOnline -url $SiteTemplateURL -Credentials $myCred
#Create new Site
New-PnPWeb -Title "This PNP Test 11" -Url $ApplyTemplatetoURL -Description "This is a test 11 for PNP templates" -Locale 1033 -Template "STS#3" -ErrorAction SilentlyContinue

Connect-PnPOnline -url https://andreir2020.sharepoint.com/sites/BLA/$ApplyTemplatetoURL -Credentials $myCred

 
 

View solution in original post

1 REPLY 1
pbnet
New Member

OK, solved it:

 

#Dynamic parameters to pass to PowerAutomate
param(
    [Parameter(Mandatory=$true)]
    [string]$SiteTemplateURL,
    [Parameter(Mandatory=$true)]
    [string]$ApplyTemplatetoURL
)
#Credentials
$myCred = Get-AutomationPSCredential -Name "SPOAdminCred"

Connect-PnPOnline -url $SiteTemplateURL -Credentials $myCred
#Create new Site
New-PnPWeb -Title "This PNP Test 11" -Url $ApplyTemplatetoURL -Description "This is a test 11 for PNP templates" -Locale 1033 -Template "STS#3" -ErrorAction SilentlyContinue

Connect-PnPOnline -url https://andreir2020.sharepoint.com/sites/BLA/$ApplyTemplatetoURL -Credentials $myCred

 
 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,908)