Forum Discussion
KorayKazak
Apr 19, 2023Brass Contributor
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.  ...
Makenx2022
May 01, 2023Copper 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.
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.