JiraBug is a Python-based automation service designed to streamline exception management by integrating Azure Application Insights with Jira. It automatically captures application exceptions, filters duplicates, and creates structured Jira tickets—saving developers and DevOps teams valuable time.
Explore the complete code on GitHub: https://github.com/prometheantechws/appinsights-jira-automation.git
Before using JiraBug, ensure you have:
Flask
, Waitress
, requests
, azure-data-tables
, azure-identity
git clone https://github.com/prometheantechws/appinsights-jira-automation.git
cd appinsights-jira-automation
pip install -r requirements.txt
Create a .env
file:
JIRA_URL=https://your-jira-instance.atlassian.net
[email protected]
JIRA_TOKEN=your-jira-api-token
JIRA_PROJECT=YOURPROJECT
AZURE_CONNECTION_STRING=your-azure-storage-connection-string
APPINSIGHTS_APP_ID=your-app-insights-app-id
APPINSIGHTS_API_KEY=your-app-insights-api-key
AZURE_VAULT_NAME=your-keyvault-name
docker build -t jirabug .
docker run -d -p 5000:5000 --env-file .env jirabug
You can deploy Azure resources manually via CLI or automatically with Bicep.
az group create --name YourResourceGroup --location eastus
az storage account create --name YourStorageAccount --resource-group YourResourceGroup --location eastus --sku Standard_LRS
az storage table create --name ExceptionTracking --account-name YourStorageAccount
az monitor app-insights component create --app YourAppInsightsName --location eastus --resource-group YourResourceGroup --application-type web
az acr create --resource-group YourResourceGroup --name YourACR --sku Basic
az keyvault create --name YourKeyVault --resource-group YourResourceGroup --location eastus
az keyvault secret set --vault-name YourKeyVault --name "APPINSIGHTS-APP-ID" --value "<App Insights ID>"
az keyvault secret set --vault-name YourKeyVault --name "APPINSIGHTS-API-KEY" --value "<App Insights API Key>"
az keyvault secret set --vault-name YourKeyVault --name "JIRA-URL" --value "<Jira URL>"
az keyvault secret set --vault-name YourKeyVault --name "JIRA-EMAIL" --value "<Jira Email>"
az keyvault secret set --vault-name YourKeyVault --name "JIRA-TOKEN" --value "<Jira API Token>"
az keyvault secret set --vault-name YourKeyVault --name "JIRA-PROJECT" --value "<Jira Project Key>"
az keyvault secret set --vault-name YourKeyVault --name "AZURE-CONNECTION-STRING" --value "<Storage Connection String>"
az identity create --name jiraBugIdentity --resource-group YourResourceGroup
PRINCIPAL_ID=$(az identity show --name jiraBugIdentity --resource-group YourResourceGroup --query principalId -o tsv)
az keyvault set-policy --name YourKeyVault --object-id $PRINCIPAL_ID --secret-permissions get
az containerapp env create --name jiraBugEnv --resource-group YourResourceGroup --location eastus
az containerapp create --name jiraBugApp --resource-group YourResourceGroup --environment jiraBugEnv --image YourACR.azurecr.io/jirabug:latest --assign-identity $PRINCIPAL_ID --env-vars ENV_FILE=.env AZURE_VAULT_NAME=YourKeyVault
az deployment group create --resource-group YourResourceGroup --template-file infra.bicep --parameters environmentName=dev
az deployment group create --resource-group YourResourceGroup --template-file main.bicep --parameters environmentName=dev
from dateutil.parser import parse
import requests
def query_app_insights():
query = """
exceptions
| where timestamp >= ago(1h)
| project timestamp, problemId, type, outerMessage, customDimensions
| order by timestamp desc
"""
response = requests.post(
f"https://api.applicationinsights.io/v1/apps/{APPINSIGHTS_APP_ID}/query",
headers={"X-Api-Key": APPINSIGHTS_API_KEY},
json={"query": query},
)
return response.json()
def is_exception_processed(problem_id, timestamp):
client = get_table_client()
row_key = parse(timestamp).strftime("%Y%m%d%H%M%S")
entities = client.query_entities(f"RowKey eq '{row_key}'")
return next(entities, None) is not None
def create_jira_issue(summary, description):
payload = {
"fields": {
"project": {"key": JIRA_PROJECT},
"summary": summary,
"description": description,
"issuetype": {"name": "Bug"}
}
}
response = requests.post(
f"{JIRA_URL}/rest/api/2/issue",
json=payload,
auth=HTTPBasicAuth(JIRA_EMAIL, JIRA_TOKEN)
)
return response.json()
waitress-serve --port=5000 jirabug:app
See the repository and contribute: https://github.com/prometheantechws/appinsights-jira-automation.git
Thank you for reading our guide on "Automate Bug Ticket Creation from Azure App Insights to Jira". We hope this walkthrough gave you valuable insights into streamlining your bug tracking process using JiraBug.
If you have any questions, need support setting it up, or are looking to automate and scale your observability and DevOps practices—our team at PrometheanTech is here to help! Whether you're modernizing your cloud infrastructure, enhancing microservices observability, or just want to reduce the noise in your bug triage process, let’s talk.
🌐 Website: https://www.prometheanz.com
📧 Email: [email protected]
Copyright © 2025 PrometheanTech. All Rights Reserved.