Azure Application Insights,如何通过 Azure CLI 更改每日上限
Azure Application Insights, how to change daily cap by Azure CLI
我正在尝试更改我在 Azure 上的所有 Application Insights 的每日数据传输上限。有什么办法可以为他们全部改变吗?
我找不到如何使用 Azure CLI 执行此操作。
谢谢。
从今天开始,您无法使用 Azure CLI 甚至 Azure REST API 更改应用程序洞察组件的每日上限。
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.
数据source/Reference:
https://docs.microsoft.com/en-us/azure/application-insights/app-insights-pricing#data-rate
您可以使用 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
这是@RonDBA 解决方案的修改版本,其中包含一些逻辑来解析名称并根据名称设置限制。使用这个脚本,我能够在几秒钟内更新数百个每日上限。
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
}
我正在尝试更改我在 Azure 上的所有 Application Insights 的每日数据传输上限。有什么办法可以为他们全部改变吗?
我找不到如何使用 Azure CLI 执行此操作。
谢谢。
从今天开始,您无法使用 Azure CLI 甚至 Azure REST API 更改应用程序洞察组件的每日上限。
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.
数据source/Reference:
https://docs.microsoft.com/en-us/azure/application-insights/app-insights-pricing#data-rate
您可以使用 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
这是@RonDBA 解决方案的修改版本,其中包含一些逻辑来解析名称并根据名称设置限制。使用这个脚本,我能够在几秒钟内更新数百个每日上限。
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
}