Azure Application Insights, how to change daily ca

2019-09-16 07:41发布

I'm trying to change daily cap for data transfer for all my Application Insights on Azure. Is there any way to change it for all of them?

I can't find how to do it by using Azure CLI.

Thank you.

3条回答
劫难
2楼-- · 2019-09-16 07:56

i don't have enough reputation to upvote... but ronDBA has the correct solution = i was able to update hundreds of daily caps in a matter of seconds. i modified his script copied below with some added logic to parse the names and set limits based on their name.

import-module azurerm.applicationinsights

Login-AzureRmAccount
Set-AzureRmContext -SubscriptionName "yoursubscription here"

$ai = Get-AzureRmApplicationInsights | select ResourceGroupName, Name

$AI | foreach {
    $cap = 1
    $color = 'red'
    if($_.Name -match 'dev'){
        $cap = .12
        $color = 'green'
    }
    if($_.Name -match 'stg'){
        $cap = .24
        $color = 'blue'
    }
    if($cap -eq 1)
    {
        if($_.Name -match 'api'){
            $cap = 1.4
            $color = 'yellow'
        }
        else{$cap = 2.9}
    }

    write-host ("Attempting to set daily cap at $cap for {0} instance " -f $_.ResourceGroupName) -NoNewline
    write-host $_.Name -ForegroundColor $color
    Set-AzureRmApplicationInsightsDailyCap -ResourceGroupName $_.ResourceGroupName -Name $_.Name -DailyCapGB $cap
}
查看更多
Root(大扎)
3楼-- · 2019-09-16 08:01

You can change the daily cap with the Azure PowerShell cmdlet Set-AzureRmApplicationInsightsDailyCap.

Login-AzureRmAccount
Set-AzureRmContext -SubscriptionName "Your Sub Name"

function Set-DailyCap {

    $AI = Get-AzureRmApplicationInsights | Select ResourceGroupName, Name 

    $AI | foreach { 
    write-output ("Attempting to set daily cap for App Insights in resource group {0} instance {1}" -f $_.ResourceGroupName, $_.Name)
    Set-AzureRmApplicationInsightsDailyCap -ResourceGroupName $_.ResourceGroupName -Name $_.Name -DailyCapGB 0.2 

    }
}

Set-DailyCap
查看更多
可以哭但决不认输i
4楼-- · 2019-09-16 08:02

There is no way you can change the daily cap of your application insights component using Azure CLI or even Azure REST APIs as of today.

To change it, use the Daily volume cap blade, linked from the Data Volume Management blade (see below). Note that some subscription types have credit which cannot be used for Application Insights. If the subscription has a spending limit, the daily cap blade will have instructions how to remove it and enable the daily cap to be raised beyond 32.3 MB/day.

enter image description here

Data source/Reference:

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-pricing#data-rate

查看更多
登录 后发表回答