ASQ

0.1.5


ASQ (Azure Smart Queries) PowerShell Module
This module provides the ability to generate reports out of Azure using a natural language via OpenAI within PowerShell

Overview
The ASQ (Azure Smart Queries) PowerShell Module is an automation tool designed to:

- Deploy a pre-configured lab environment with required Azure resources.
- Enable natural language quer

ASQ (Azure Smart Queries) PowerShell Module
This module provides the ability to generate reports out of Azure using a natural language via OpenAI within PowerShell

Overview
The ASQ (Azure Smart Queries) PowerShell Module is an automation tool designed to:

- Deploy a pre-configured lab environment with required Azure resources.
- Enable natural language queries against Azure services without requiring users to write Kusto Query Language (KQL).
- By leveraging Azure OpenAI, this module translates user input into valid queries, executes them against Azure resources, and retrieves structured results, making it easier to generate reports and insights.

Features
- Automated Lab Deployment: Sets up an Azure Function App and an App Service Plan with required configurations.
- Natural Language Queries: Allows users to query Azure resources using everyday language.
- Azure OpenAI Integration: Converts natural language into structured queries for execution.
- Pre-configured HTTP Trigger Function: A serverless function handles queries and interacts with Azure services.
- Simplified Report Generation: Retrieves relevant data without writing complex queries.

Dependencies & Prerequisites
- Before using the query functionality, users must deploy the required lab environment. The module depends on:

Azure OpenAI Service

- Required for processing natural language input into valid KQL queries.
- Existing OpenAI Service on Azure.
- An active OpenAI deployment within an Azure subscription is required.

User-Assigned Managed Identity

- A user-assigned managed identity must have:
- Reader or Log Analytics Reader role for querying logs.
- Contributor access for deploying resources.
- Azure OpenAI API access for processing queries.
- App Service Plan & Azure Function

The module automatically provisions:
A Resource Group named AzureSmartQueriesXXXXXXX
An App Service Plan
An Azure Function App
A pre-configured HTTP trigger function

Installation:
To install the ASQ module from PowerShell Gallery, run:

Install-Module -Name ASQ

Deployment of Lab Environment:
Before running queries, users must first deploy the required Azure infrastructure using the following command:

Invoke-ASQSetup

This command will:
✔ Setup Azure Context, asking you to specify the names of UAMI and Azure OpenAI Instance and then connect to an Azure subscription interactively. It will store the context in a config file in \TEMP\ASQ\ folder
✔ Provision an App Service Plan
✔ Deploy an Azure Function App
✔ Configure a pre-set HTTP trigger function

Once the deployment is complete, users can begin sending natural language queries using one of the following methods.

Usage Example:

Option 1
ASQ -query 'List all virtual networks across the tenant with their names and locations'

Option 2
Azure function details will be displayed once the deployment is complete. You can also get the URI whenever you want by running Get-ASQUri cmdlet.
Users can execute queries like:

irm "FUNCTIONURI" -body '@{"query":"List all network security groups across the tenant with their names and locations"}'

As long as you have the URI, you can obviously use it from anywhere like bash, vscode, terminal etc.

Note: Once the deployment is finished, give the function app a couple of minutes to download and install dependencies such as required PowerShell modules
Show more

Minimum PowerShell version

7.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name ASQ

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name ASQ

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) Baki Onur Okutucu - MVP. All rights reserved.

Package Details

Author(s)

  • Baki Onur Okutucu - MVP

Tags

PowerShell GPT Azure OpenAI Agent Assistant AI

Functions

Create-SetupFile Validate-ASQSetup Invoke-ByeBye Get-ASQURI Invoke-ASQSetup ASQ

Dependencies

This module has no dependencies.

Release Notes

Bug fixes and improvements including connecting to Azure and selecting the right subscription and storing the context for future use.

FileList

Version History

Version Downloads Last updated
0.1.5 (current version) 20 3/4/2025