Run Azure CLI
Is it possible to use azure cli within Azure Functions?
I am wanting to run a command az acs scale ... on a timely bases from Azure Functions.
You can use PowerShell Azure functions and run Azure Powershell commands once you logged in with ServicePrincipal credentials. Store your service principal user and password in Function App's AppSettings Sample code for logging in from command line:
$secstr = New-Object -TypeName System.Security.SecureString $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)} $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $env:spusername, $secstr
Login-AzureRmAccount -Credential $cred -ServicePrincipal -TenantId 72f988bf-86f1-41af-91ab-2d7cd011db47 Write-Output "PowerShell Timer trigger function logged in";
Once logged in, you should be able to run any other commands
Closing this issue. Please reactivate if you still need help.
@pragnagopa can you execute azure cli within Azure Functions?
https://github.com/Azure/azure-functions-powershell-worker/issues/221
