Create Pull Request
| Date | Scan | Status | Result |
|---|---|---|---|
| 2025-07-12 23:44 | #41 | cancelled |
Biased
|
| 2025-07-12 00:58 | #8 | cancelled |
Clean
|
| 2025-07-10 05:06 | #7 | processing |
Clean
|
| 2025-07-09 23:22 | #6 | cancelled |
Clean
|
Connect-AzAccount
$json =Â (Get-content -path 'JsonPath\test.json' -Raw) | Out-string
$job = Start-AzAutomationRunbook @RBParams
Param ( [Parameter (Mandatory= $true/$false)] [Type] $Name1 = <Default value>, [Parameter (Mandatory= $true/$false)] [Type] $Name2 = <Default value> )
[Parameter (Mandatory = $true)] [object] $FullName
@{"FirstName"="Joe";"MiddleName"="Bob";"LastName"="Smith"}
$params = @{"VMName"="WSVMClassic";"resourceGroupeName"="WSVMClassicSG"}
Start-AzAutomationRunbook -AutomationAccountName "TestAutomation" -Name "Get-AzureVMGraphical" –ResourceGroupName $resourceGroupName -Parameters $params
$params = @{"VMName"="WSVMClassic"; "ServiceName"="WSVMClassicSG"}
Start-AzureAutomationRunbook -AutomationAccountName "TestAutomation" -Name "Get-AzureVMGraphical" -Parameters $params
IDictionary<string, string> RunbookParameters = new Dictionary<string, string>();
// Add parameters to the dictionary.
RunbookParameters.Add("VMName", "WSVMClassic");
RunbookParameters.Add("resourceGroupName", "WSSC1");
//Call the StartRunbook method with parameters
StartRunbook("Get-AzureVMGraphical", RunbookParameters);
{
"properties":{
"runbook":{
"name":"Get-AzureVMTextual"},
"parameters":{
"VMName":"WindowsVM",
"resourceGroupName":"ContosoSales"}
}
}
Param(
[parameter(Mandatory=$true)]
[object]$json
)
# Ensures you do not inherit an AzContext in your runbook
Disable-AzContextAutosave -Scope Process
# Connect to Azure with system-assigned managed identity
$AzureContext = (Connect-AzAccount -Identity).context
# set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext
# Convert object to actual JSON
$json = $json | ConvertFrom-Json
# Use the values from the JSON object as the parameters for your command
Start-AzVM -Name $json.VMName -ResourceGroupName $json.ResourceGroup -DefaultProfile $AzureContext
$JsonParams = @{"json"=$json}
$RBParams = @{
AutomationAccountName = 'AATest'
ResourceGroupName = 'RGTest'
Name = 'Test-Json'
Parameters = $JsonParams
}