Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
Maliyet Yönetimindeki Bütçeler, kuruluşunuzda sorumluluğu planlamanıza ve güçlendirmenize yardımcı olur. Bütçeleri kullanarak belirli bir dönem içinde kullandığınız veya abone olduğunuz Azure hizmetlerini takip edebilirsiniz. Maliyetleri proaktif olarak yönetmek ve harcamaların zaman içindeki ilerlemesini izlemek için diğer kişileri harcamaları hakkında bilgilendirmenize yardımcı olur. Oluşturduğunuz bütçe eşikleri aşıldığında bildirimler tetiklenir. Kaynaklarınızın hiçbiri etkilenmez ve tüketiminiz durdurulmaz. Bütçeleri kullanarak maliyet analizi sırasında harcamaları karşılaştırabilir ve izleyebilirsiniz. Bu hızlı başlangıçta, Bicep kullanarak 'MyBudget' adlı bir bütçenin nasıl oluşturulacağı gösterilmektedir.
Bicep, Azure kaynaklarını dağıtmak için bildirim temelli söz dizimi kullanan, etki alanına özgü bir dildir (DSL). Kısa sözdizimi, güvenilir tür güvenliği ve kod yeniden kullanımı için destek sağlar. Bicep, Azure'daki kod olarak altyapı çözümleriniz için en iyi yazma deneyimini sunar.
Önkoşullar
Azure aboneliğiniz yoksa başlamadan önce ücretsiz bir hesap oluşturun.
Yeni bir aboneliğiniz varsa hemen bir bütçe oluşturamaz veya diğer Maliyet Yönetimi özelliklerini kullanamazsınız. Maliyet Yönetimi özelliklerini kullanabilmek için 48 saat kadar beklemeniz gerekebilir.
Bütçeler, aşağıdaki Azure hesap türleri ve kapsamlar için desteklenir:
- Azure rol tabanlı erişim denetimi (Azure RBAC) kapsamları
- Yönetim grupları
- Abonelik
- Kurumsal Anlaşma kapsamları
- Fatura hesabı
- Department
- Kayıt hesabı
- Bireysel sözleşmeler
- Fatura hesabı
- Microsoft Müşteri Sözleşmesi kapsamları
- Fatura hesabı
- Billing profile
- Fatura bölümü
- Müşteri
Bütçeleri görüntülemek için Azure hesabınızda en azından okuma yetkisine sahip olmanız gerekir.
Azure EA aboneliklerinde bütçeleri görüntülemek için okuma yetkisine sahip olmanız gerekir. Bütçe oluşturmak ve yönetmek için katkıda bulunan izninizin olması gerekir.
Aşağıdaki Azure izinleri veya kapsamları, kullanıcı ve gruba göre bütçeler için abonelik başına desteklenir. Kapsamlar hakkında daha fazla bilgi için bkz. Kapsamları anlama ve birlikte çalışma.
- Sahip: Bir abonelik için bütçe oluşturabilir, değiştirebilir veya silebilir.
- Contributor and Cost Management contributor: Can create, modify, or delete their own budgets. Başkaları tarafından oluşturulan bütçelerin miktarlarını değiştirebilir.
- Reader and Cost Management reader: Can view budgets that they have permission to.
Maliyet Yönetimi verilerine izin atama hakkında daha fazla bilgi için bkz. Maliyet Yönetimi verilerine erişim atama.
Filtre yok
Review the Bicep file
Bu hızlı başlangıçta kullanılan Bicep dosyası Azure Hızlı Başlangıç Şablonları'ndan alınmıştı.
targetScope = 'subscription'
@description('Name of the Budget. It should be unique within a resource group.')
param budgetName string = 'MyBudget'
@description('The total amount of cost or usage to track with the budget')
param amount int = 1000
@description('The time covered by a budget. Tracking of the amount will be reset based on the time grain.')
@allowed([
'Monthly'
'Quarterly'
'Annually'
])
param timeGrain string = 'Monthly'
@description('The start date must be first of the month in YYYY-MM-DD format. Future start date should not be more than three months. Past start date should be selected within the timegrain preiod.')
param startDate string
@description('The end date for the budget in YYYY-MM-DD format. If not provided, we default this to 10 years from the start date.')
param endDate string
@description('Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0.01 and 1000.')
param firstThreshold int = 90
@description('Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0.01 and 1000.')
param secondThreshold int = 110
@description('The list of email addresses to send the budget notification to when the threshold is exceeded.')
param contactEmails array
resource budget 'Microsoft.Consumption/budgets@2023-11-01' = {
name: budgetName
properties: {
timePeriod: {
startDate: startDate
endDate: endDate
}
timeGrain: timeGrain
amount: amount
category: 'Cost'
notifications: {
NotificationForExceededBudget1: {
enabled: true
operator: 'GreaterThan'
threshold: firstThreshold
contactEmails: contactEmails
}
NotificationForExceededBudget2: {
enabled: true
operator: 'GreaterThan'
threshold: secondThreshold
contactEmails: contactEmails
}
}
}
}
output name string = budget.name
output resourceId string = budget.id
Bicep dosyasında bir Azure kaynağı tanımlanır:
- Microsoft.Consumption/budgets: Bütçe oluşturun.
Deploy the Bicep file
Bicep dosyasını main.bicep olarak yerel bilgisayarınıza kaydedin.
Azure CLI veya Azure PowerShell kullanarak Bicep dosyasını dağıtın.
myContactEmails ='("user1@contoso.com", "user2@contoso.com")' az deployment sub create --name demoSubDeployment --location centralus --template-file main.bicep --parameters startDate=<start-date> endDate=<end-date> contactEmails=$myContactEmails
Aşağıdaki parametreleri girmeniz gerekir:
- startDate: Replace <start-date> with the start date. YYYY-AA-GG biçiminde ayın ilki olmalıdır. Gelecekteki başlangıç tarihi, gelecekte üç aydan uzun olmamalıdır. Zaman dilimi içinde geçmiş bir başlangıç tarihi seçilmelidir.
- endDate: Bitiş tarihini<>. Sağlanmazsa, başlangıç tarihinden itibaren varsayılan süre on yıl olur.
- contactEmails: Önce e-postalarınızı tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Eşik aşıldığında bütçe bildirimini göndermek için örnek e-postaları e-posta adresleriyle değiştirin.
Note
Dağıtım tamamlandığında, dağıtımın başarılı olduğunu belirten bir ileti görmeniz gerekir.
Bir filtre
Review the Bicep file
Bu hızlı başlangıçta kullanılan Bicep dosyası Azure Hızlı Başlangıç Şablonları'ndan alınmıştı.
targetScope = 'subscription'
@description('Name of the Budget. It should be unique within a resource group.')
param budgetName string = 'MyBudget'
@description('The total amount of cost or usage to track with the budget')
param amount int = 1000
@description('The time covered by a budget. Tracking of the amount will be reset based on the time grain.')
@allowed([
'Monthly'
'Quarterly'
'Annually'
])
param timeGrain string = 'Monthly'
@description('The start date must be first of the month in YYYY-MM-DD format. Future start date should not be more than three months. Past start date should be selected within the timegrain preiod.')
param startDate string
@description('The end date for the budget in YYYY-MM-DD format. If not provided, we default this to 10 years from the start date.')
param endDate string
@description('Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0.01 and 1000.')
param firstThreshold int = 90
@description('Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0.01 and 1000.')
param secondThreshold int = 110
@description('The list of email addresses to send the budget notification to when the threshold is exceeded.')
param contactEmails array
@description('The set of values for the resource group filter.')
param resourceGroupFilterValues array
resource budget 'Microsoft.Consumption/budgets@2021-10-01' = {
name: budgetName
properties: {
timePeriod: {
startDate: startDate
endDate: endDate
}
timeGrain: timeGrain
amount: amount
category: 'Cost'
notifications: {
NotificationForExceededBudget1: {
enabled: true
operator: 'GreaterThan'
threshold: firstThreshold
contactEmails: contactEmails
}
NotificationForExceededBudget2: {
enabled: true
operator: 'GreaterThan'
threshold: secondThreshold
contactEmails: contactEmails
}
}
filter: {
dimensions: {
name: 'ResourceGroupName'
operator: 'In'
values: resourceGroupFilterValues
}
}
}
}
Bicep dosyasında bir Azure kaynağı tanımlanır:
- Microsoft.Consumption/budgets: Bütçe oluşturun.
Deploy the Bicep file
Bicep dosyasını main.bicep olarak yerel bilgisayarınıza kaydedin.
Azure CLI veya Azure PowerShell kullanarak Bicep dosyasını dağıtın.
myContactEmails ='("user1@contoso.com", "user2@contoso.com")' myRgFilterValues ='("resource-group-01", "resource-group-02")' az deployment sub create --name demoSubDeployment --location centralus --template-file main.bicep --parameters startDate=<start-date> endDate=<end-date> contactEmails=$myContactEmails resourceGroupFilterValues=$myRgFilterValues
Aşağıdaki parametreleri girmeniz gerekir:
- startDate: Replace <start-date> with the start date. YYYY-AA-GG biçiminde ayın ilki olmalıdır. Gelecekteki başlangıç tarihi, gelecekte üç aydan uzun olmamalıdır. Zaman dilimi içinde geçmiş bir başlangıç tarihi seçilmelidir.
- endDate: Bitiş tarihini<>. Sağlanmazsa, başlangıç tarihinden itibaren varsayılan süre on yıl olur.
- contactEmails: Önce e-postalarınızı tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Eşik aşıldığında bütçe bildirimini göndermek için örnek e-postaları e-posta adresleriyle değiştirin.
- resourceGroupFilterValues Önce kaynak grubu filtre değerlerinizi tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Örnek filtre değerlerini kaynak grubu filtrenizin değer kümesiyle değiştirin.
Note
Dağıtım tamamlandığında, dağıtımın başarılı olduğunu belirten bir ileti görmeniz gerekir.
İki veya daha fazla filtre
Review the Bicep file
Bu hızlı başlangıçta kullanılan Bicep dosyası Azure Hızlı Başlangıç Şablonları'ndan alınmıştı.
targetScope = 'subscription'
@description('Name of the Budget. It should be unique within a resource group.')
param budgetName string = 'MyBudget'
@description('The total amount of cost or usage to track with the budget')
param amount int = 1000
@description('The time covered by a budget. Tracking of the amount will be reset based on the time grain.')
@allowed([
'Monthly'
'Quarterly'
'Annually'
])
param timeGrain string = 'Monthly'
@description('The start date must be first of the month in YYYY-MM-DD format. Future start date should not be more than three months. Past start date should be selected within the timegrain preiod.')
param startDate string
@description('The end date for the budget in YYYY-MM-DD format. If not provided, we default this to 10 years from the start date.')
param endDate string
@description('Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0.01 and 1000.')
param firstThreshold int = 90
@description('Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0.01 and 1000.')
param secondThreshold int = 110
@description('The list of contact roles to send the budget notification to when the threshold is exceeded.')
param contactRoles array = [
'Owner'
'Contributor'
'Reader'
]
@description('The list of email addresses to send the budget notification to when the threshold is exceeded.')
param contactEmails array
@description('The list of action groups to send the budget notification to when the threshold is exceeded. It accepts array of strings.')
param contactGroups array
@description('The set of values for the resource group filter.')
param resourceGroupFilterValues array
@description('The set of values for the meter category filter.')
param meterCategoryFilterValues array
resource budget 'Microsoft.Consumption/budgets@2021-10-01' = {
name: budgetName
properties: {
timePeriod: {
startDate: startDate
endDate: endDate
}
timeGrain: timeGrain
amount: amount
category: 'Cost'
notifications: {
NotificationForExceededBudget1: {
enabled: true
operator: 'GreaterThan'
threshold: firstThreshold
contactEmails: contactEmails
contactRoles: contactRoles
contactGroups: contactGroups
}
NotificationForExceededBudget2: {
enabled: true
operator: 'GreaterThan'
threshold: secondThreshold
contactEmails: contactEmails
contactRoles: contactRoles
contactGroups: contactGroups
thresholdType: 'Forecasted'
}
}
filter: {
and: [
{
dimensions: {
name: 'ResourceGroupName'
operator: 'In'
values: resourceGroupFilterValues
}
}
{
dimensions: {
name: 'MeterCategory'
operator: 'In'
values: meterCategoryFilterValues
}
}
]
}
}
}
Bicep dosyasında bir Azure kaynağı tanımlanır:
- Microsoft.Consumption/budgets: Bütçe oluşturun.
Deploy the Bicep file
Bicep dosyasını main.bicep olarak yerel bilgisayarınıza kaydedin.
Azure CLI veya Azure PowerShell kullanarak Bicep dosyasını dağıtın.
myContactEmails ='("user1@contoso.com", "user2@contoso.com")' myContactGroups ='("/subscriptions/{sub-id}/resourceGroups/{rg-name}/providers/microsoft.insights/actionGroups/groupone", "/subscriptions/{sub-id}/resourceGroups/{rg-name}/providers/microsoft.insights/actionGroups/grouptwo")' myRgFilterValues ='("resource-group-01", "resource-group-02")' myMeterCategoryFilterValues ='("meter-category-01", "meter-category-02")' az deployment sub create --name demoSubDeployment --location centralus --template-file main.bicep --parameters startDate=<start-date> endDate=<end-date> contactEmails=$myContactEmails contactGroups=$myContactGroups resourceGroupFilterValues=$myRgFilterValues meterCategoryFilterValues=$myMeterCategoryFilterValues
Aşağıdaki parametreleri girmeniz gerekir:
- startDate: Replace <start-date> with the start date. YYYY-AA-GG biçiminde ayın ilki olmalıdır. Gelecekteki başlangıç tarihi, gelecekte üç aydan uzun olmamalıdır. Zaman dilimi içinde geçmiş bir başlangıç tarihi seçilmelidir.
- endDate: Bitiş tarihini<>. Sağlanmazsa, başlangıç tarihinden itibaren varsayılan süre on yıl olur.
- contactEmails: Önce e-postalarınızı tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Eşik aşıldığında bütçe bildirimini göndermek için örnek e-postaları e-posta adresleriyle değiştirin.
- contactGroups: Önce kişi gruplarınızı tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Eşik aşıldığında bütçe bildirimini göndermek için örnek kişi gruplarını eylem gruplarının listesiyle değiştirin. You must pass the resource ID of the action group, which you can get with az monitor action-group show or Get-AzActionGroup.
- resourceGroupFilterValues: Önce kaynak grubu filtre değerlerinizi tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Örnek filtre değerlerini kaynak grubu filtrenizin değer kümesiyle değiştirin.
- meterCategoryFilterValues: Önce ölçüm kategorisi filtre değerlerinizi tutan bir değişken oluşturun ve ardından bu değişkeni geçirin. Parantez içindeki örnek filtre değerlerini ölçüm kategorisi filtrenizin değer kümesiyle değiştirin.
Note
Dağıtım tamamlandığında, dağıtımın başarılı olduğunu belirten bir ileti görmeniz gerekir.
Dağıtılan kaynakları gözden geçirme
Kaynak grubundaki dağıtılan kaynakları listelemek için Azure portalını, Azure CLI'yı veya Azure PowerShell'i kullanın.
az consumption budget list
Kaynakları temizleme
Bütçeye artık ihtiyacınız kalmadığında, silmek için Azure portalı, Azure CLI veya Azure PowerShell'i kullanın:
az consumption budget delete --budget-name MyBudget
Sonraki adımlar
In this quickstart, you created a budget and deployed it using Bicep. Maliyet Yönetimi, Faturalama ve Bicep hakkında daha fazla bilgi edinmek için aşağıdaki makalelere geçin.
- Maliyet Yönetimi ve Faturalama'ya genel bakış'ı okuyun.
- Azure portalında bütçeler oluşturun.
- Bicep hakkında daha fazla bilgi edinin.