<p>We have couple of clusters running in Azure using AKS service. In clusters we are running multiple projects, each one of them has different namespace, naturally.</p>
<p>I would like to extract data about number of pods, their status and conditions etc. for specific namespace.
It is fairly easy to do locally using <code>AZ CLI</code> and installing <code>kubectl</code> (to get namespaces names) and then we can either stay in <code>kubectl</code> or use powershell <code>Az.Aks</code> <a href="https://learn.microsoft.com/en-us/powershell/module/az.aks/?view=azps-4.5.0" rel="nofollow noreferrer">module</a> to extract these information.</p>
<p>I would like to have this process fully automated and scheduled. My first thought was Azure Runbook but it is not supporting AZ CLI.</p>
<p>What would be the best way to achieve what I have mentioned above? I believe the best way would be to use only <code>kubectl</code> commands, but how can we trigger them automatically? Is a pipeline in Azure Devops a solution?</p>
<p>Thanks,
Rafal</p>

Rafał Głębocki
<p>You can use Azure Automation via RUnbooks, but just like Azure CLI you were trying you can do it through PowerShell. Runbooks can also be done using Python but for now only Python 2 is supported, and the same task can be done using Azure Functions but with so many different languages like C#, Java, Python and so many more.</p>
<p>Runbooks
<a href="https://learn.microsoft.com/en-us/azure/automation/automation-runbook-types#:%7E:text=PowerShell%20Workflow%20runbooks%20are%20text,the%20runbook%20into%20Azure%20Automation" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/automation/automation-runbook-types#:~:text=PowerShell%20Workflow%20runbooks%20are%20text,the%20runbook%20into%20Azure%20Automation</a>.</p>
<p>Azure Functions
<a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell</a></p>
