Open
Description
Description
Unable to import PowerShell automation runbook of runtime 7.2; runbook_type : "PowerShell72"
Import command is throwing invalid type error.
Issue script & Debug output
Following command returns an error when run on Self hosted agent.
[pscustomobject]@{
RunbookName='listSharePointUsersPermission';
OutputFolderPath=$outputfolderpath;
SourcePath=$sourcepath;
RunbookType="PowerShell72";
Tags=@{"Workload Name"="Development Testing Services"}
}
Import-AzAutomationRunbook `
-AutomationAccountName $targetAutomationAccountName `
-Name $eachLine.RunbookName `
-Path $eachLine.SourcePath `
-Published `
-ResourceGroupName $targetResourceGroupName `
-Type $eachLine.RunbookType `
-Force;
Environment data
Running on linux self-hosted agent.
AzurePowerShell@5 task
Module versions
azurePowerShellVersion: 'LatestVersion'
Error output
Cannot validate argument on parameter 'Type'. The argument "PowerShell72" does not belong to the set "PowerShell,GraphicalPowerShell,PowerShellWorkflow,GraphicalPowerShellWorkflow,Graph,Python2,Python3" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
Failed
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
isra-fel commentedon May 7, 2024
Hi @SiddhiGupta10 are you running the script in an Azure DevOps pipeline?
SiddhiGupta10 commentedon May 7, 2024
xandris commentedon Mar 13, 2025
I've run into this issue too. I need to import a PowerShell 7.2 workbook but that
-Type
parameter doesn't permit the valuePowerShell72
.Rincey commentedon May 20, 2025
@xandris @SiddhiGupta10
I came here to post the same issue, but with a potential solution:
VSCode IntelliSense autocompleted runbooktype as
Powershell72
which failed. But doing a get-azautomationrunbook on an existing runbook, it reported the type asPowerShell72
, so I tried the import again with the tweaked type. Worked for me that time.