Skip to content

Instantly share code, notes, and snippets.

@PlagueHO
Created October 26, 2020 02:57
Show Gist options
  • Save PlagueHO/0651ff41e8e6a800a438bbfbe9225717 to your computer and use it in GitHub Desktop.
Save PlagueHO/0651ff41e8e6a800a438bbfbe9225717 to your computer and use it in GitHub Desktop.
Execute a command on an Azure Container Instance and return a terminal
$SubscriptionId = '<subscription id>'
$ResourceGroupName = 'my-container-rg'
$AciName = 'my-container-aci'
$resourceId = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.ContainerInstance/containerGroups/$($AciName)/containers/$($AciName)"
$command = "/zap/zap-baseline.py -t 'https://myapplication.net' -x OWASP-ZAP-Report.xml"
Invoke-AzResourceAction `
-ResourceId $resourceId `
-Action 'exec' `
-ApiVersion '2019-12-01' `
-Parameters @{
command = $command
terminalSize = @{
rows = 80
cols = 80
}
} `
-Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment