0

I have a requirement to kill the active sessions currently running on Azure Analysis Services which are consuming high QPU and are running for more than 5 minutes.

I came across below article : which does similar thing and it's a manual process but I need help in understanding how can I setup an automated process which can proactively identify and kill such connections.

https://learn.microsoft.com/en-us/analysis-services/instances/disconnect-users-and-sessions-on-analysis-services-server?view=asallproducts-allversions

Appreciate any leads.

1
  • Does log analytics query works for you? @Learn2Code Commented Jan 21, 2024 at 16:13

1 Answer 1

0

How to Kill sessions running for last 5 minutes automatically in azure analysis services?

To make it work automatically, you can use either PowerShell or log analytics Kql query which is detailed below.

Disconnect sessions MS Doc.

PowerShell:

$subscription = "xxx"
$resourceGroup = "xxxx"
$serverName = "asazure://eastus.asazure.windows.net/newsj"
$uri = "https://management.azure.com/subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.AnalysisServices/servers/$serverName/sessions/$sessionId/disconnect?api-version=2017-07-14"
Invoke-RestMethod -Uri $uri -Method Post -Headers @{Authorization = "Bearer $token"}

enter image description here

KQL: (Log analytics workspace)

Sample query for your requirement looks like below:

AzureMetrics
| where Resource == "newsj"
| where MetricName == "xxx"
| summarize startat = min(TimeGenerated), timespan = max(xxx) by resourceID
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, I think log analytics can help in fetching the queries which are long running but I don't think it can cancel the session too..?
Yes sometimes. In that case you can go with the PowerShell approach. Have you tried that? @Learn2Code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.