An AI-powered agent for querying and managing Microsoft Intune via natural language using Azure AI Foundry.
Observe. Automate. Report.
Endpoint Management | Python | Public | Maintained
Intune Agent with Azure AI Foundry supports Microsoft Intune and endpoint management workflows such as automation, troubleshooting, remediation, deployment, or reporting.
- Use it when Intune work should be scripted, packaged, synchronized, or made easier to repeat.
- Most workflows start from repository assets, then move through Microsoft Graph, Intune, or device-side execution.
- This repository is maintained as a practical project and reference asset.
The repository stores scripts or tooling, administrators configure or run them, Intune and Microsoft Graph apply the work, and endpoint results feed back into reports or follow-up actions.
flowchart LR
Repo[Repository assets] --> Admin[Administrator workflow]
Admin --> Graph[Microsoft Graph or Intune]
Graph --> Device[Managed endpoint]
Device --> Result[Detection, remediation, or report]
Result --> Review[Review and iterate]
Review --> Repo
-
Review the project context and workflow below.
-
Clone the repository:
git clone https://github.com/JayRHa/IntuneAgent.git
-
Continue with the setup, usage, or workflow sections below.
This project provides two implementation approaches:
| Approach | File | Description |
|---|---|---|
| Direct OpenAI SDK | main.py |
Uses Azure OpenAI SDK directly with manual tool definitions |
| Microsoft Agent Framework | main_agent_framework.py |
Uses the new unified Agent Framework (successor to Semantic Kernel + AutoGen) |
- Built-in
@ai_functiondecorator for cleaner tool definitions - Native support for approval workflows on destructive actions
- Graph-based workflows for multi-agent orchestration
- Built-in OpenTelemetry integration for observability
- Middleware support for intercepting agent actions
- Azure subscription with an active Intune license
- Azure AI Foundry resource with a deployed model (GPT-4o or GPT-4)
- An app registration in Entra ID with Graph API permissions
- Python 3.10+ (3.10+ required for Microsoft Agent Framework)
Your app registration needs these Microsoft Graph API permissions (Application permissions). The setup.sh script configures these automatically:
DeviceManagementManagedDevices.Read.AllDeviceManagementManagedDevices.ReadWrite.AllDeviceManagementManagedDevices.PrivilegedOperations.AllDeviceManagementConfiguration.Read.AllDeviceManagementConfiguration.ReadWrite.AllDeviceManagementApps.Read.AllDeviceManagementApps.ReadWrite.AllDeviceManagementRBAC.Read.AllDeviceManagementServiceConfig.Read.All
-
Clone the repository
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy
.env.exampleto.envand configure:cp .env.example .env
-
Edit
.envwith your settings:AZURE_OPENAI_API_KEY: Your Azure OpenAI API keyAZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpoint URLMODEL_DEPLOYMENT_NAME: The deployed model name (e.g.,gpt-4o)AZURE_TENANT_ID: Your Entra ID tenant IDAZURE_CLIENT_ID: Your app registration client IDAZURE_CLIENT_SECRET: Your app registration client secret
python main.pypython main_agent_framework.py- "Show me all non-compliant devices"
- "Which Windows devices haven't synced in 48 hours?"
- "Break down our fleet by OS"
- "Find devices without disk encryption"
- "How many devices do we have?"
- "Show me all compliance policies"
| Tool | Description |
|---|---|
get_device_count |
Get total count of managed devices |
get_noncompliant_devices |
List all non-compliant devices |
get_devices_by_os |
Filter devices by operating system |
get_stale_devices |
Find devices that haven't synced recently |
get_device_breakdown_by_os |
Get device counts grouped by OS |
get_compliance_policies |
List all compliance policies |
sync_device |
Trigger a device sync |
get_devices_without_encryption |
Find unencrypted devices |
intune-agent-foundry/
├── main.py # Classic agent (direct OpenAI SDK)
├── main_agent_framework.py # Agent using Microsoft Agent Framework
├── graph_helper.py # Microsoft Graph API client
├── intune_tools.py # Function tools (classic approach)
├── requirements.txt # Python dependencies
├── setup.sh # Azure app registration setup script
├── .env.example # Environment variable template
└── README.md