Azure SQL Database
An Azure relational database service.
5,405 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a child runbook like in the following
Param
(
[String] $dblist
)
invoke-sqlcmd -ServerInstance "xxxxxxxxx.database.windows.net" -Database $dblist -Credential $SQLServerCred -Query "$getstatsQuery" -Encrypt |format-table| Out-file $LogFull -width 400
and another parent runbook
<#
This PowerShell script was automatically converted to PowerShell Workflow so it can be run as a runbook.
Specific changes that have been made are marked with a comment starting with “Converter:”
#>
workflow sqlmain {
# Ensure that the runbook does not inherit an AzContext
Disable-AzContextAutosave –Scope Process
# Connect to Azure with Run As account
$ServicePrincipalConnection = Get-AutomationConnection -Name 'AzureRunAsConnection'
Connect-AzAccount `
-ServicePrincipal `
-Tenant $ServicePrincipalConnection.TenantId `
-ApplicationId $ServicePrincipalConnection.ApplicationId `
-CertificateThumbprint $ServicePrincipalConnection.CertificateThumbprint
$AzureContext = Set-AzContext -SubscriptionId $ServicePrincipalConnection.SubscriptionID
# Converter: Wrapping initial script in an InlineScript activity, and passing any parameters for use within the InlineScript
# Converter: If you want this InlineScript to execute on another host rather than the Automation worker, simply add some combination of -PSComputerName, -PSCredential, -PSConnectionURI, or other workflow common parameters (http://technet.microsoft.com/en-us/library/jj129719.aspx) as parameters of the InlineScript
$dblist2= "mydb"
foreach -parallel ($db in $dblist2){
# inlineScript {
Start-AzAutomationRunbook -ResourceGroupName "xxxxxx" -AutomationAccountName "xxxxxx" -Name "xxxxxx" -Parameters @{"dblist"=$db}
}
# }
}
but the parameter input to the childrunbook is
why is that?
finally got what's the problem
Start-AzAutomationRunbook -ResourceGroupName "xxxxxx" -AutomationAccountName "xxxxxx" -Name "xxxxxx" -Parameters @{"dblist"="$db"}
need to quote the $db too...