Forum Discussion

KorayKazak's avatar
KorayKazak
Brass Contributor
Apr 19, 2023

Azure Application Insights automate Availability Tests

Hello together

I would like to ask for your knowledge and know-how.
I have the following problem:

How can I start or stop multiple Availability tests with a script in Azure Application Insights.

Currently, I am manually stopping and restarting each test under Availability one by one.

Is there a way to automate this so that all tests can be stopped or started at the same time?

Best thanks for any feedback
I hope something can be worked out

Love greetings
Koray

 

1 Reply

  • Makenx2022's avatar
    Makenx2022
    Copper Contributor
    Yes, you can use Azure PowerShell or Azure CLI to start or stop multiple Availability Tests in Azure Application Insights.
    1. Install Azure PowerShell
    2. Connect to your Azure subscription using the following command: Connect-AzAccount.
    3. Get the list of Availability Tests using the following command: $tests = Get-AzApplicationInsightsAvailabilityTest -ResourceGroupName <resourceGroupName> -Name <applicationInsightsName>.
    4. Start or stop the tests using the following command: $tests | ForEach-Object { Start-AzApplicationInsightsAvailabilityTest -ResourceGroupName <resourceGroupName> -Name <applicationInsightsName> -Location <location> -AvailabilityTest $_ -State <state> }.

    replace <resourceGroupName>, <applicationInsightsName>, <location>, <state> with the appropriate values. <state> can be either "Started" or "Stopped".
    You can convert the step 4 into a PowerShell script to automate the process of starting and stopping multiple availability tests and schedule accordingly.

Resources