Aracılığıyla paylaş


Cost Allocation Rules - Create Or Update

Bir ödeme hesabı veya kurumsal kayıt içindeki farklı kaynaklar arasında maliyet ayırmak için bir kural oluşturun/güncelleştirin.

PUT https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}?api-version=2023-11-01

URI Parametreleri

Name İçinde Gerekli Tür Description
billingAccountId
path True

string

FaturalamaHesap Kimliği

ruleName
path True

string

Maliyet ayırma kuralı adı. Ad boşluk veya '_' ve '-' dışında alfasayısal olmayan karakterler içeremez. Maksimum uzunluk 260 karakterdir.

Regex pattern: [A-Za-z0-9\-_]+

api-version
query True

string

Bu işlem için kullanılacak API sürümü.

İstek Gövdesi

Name Tür Description
properties

CostAllocationRuleProperties

Maliyet ayırma kuralı özellikleri

Yanıtlar

Name Tür Description
200 OK

CostAllocationRuleDefinition

Tamam ögesini seçin. Güncelleştirme isteği başarılı oldu.

201 Created

CostAllocationRuleDefinition

Oluşturulan. İstek başarılı oldu.

Other Status Codes

ErrorResponse

İşlemin neden başarısız olduğunu açıklayan hata yanıtı.

Güvenlik

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation kullanıcı hesabınızın kimliğine bürünme

Örnekler

CostAllocationRulesCreateResourceGroup
CostAllocationRulesCreateTag

CostAllocationRulesCreateResourceGroup

Sample Request

PUT https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule?api-version=2023-11-01

{
  "properties": {
    "description": "This is a testRule",
    "status": "Active",
    "details": {
      "sourceResources": [
        {
          "resourceType": "Dimension",
          "name": "ResourceGroupName",
          "values": [
            "sampleRG",
            "secondRG"
          ]
        }
      ],
      "targetResources": [
        {
          "resourceType": "Dimension",
          "policyType": "FixedProportion",
          "name": "ResourceGroupName",
          "values": [
            {
              "name": "destinationRG",
              "percentage": 45
            },
            {
              "name": "destinationRG2",
              "percentage": 54
            }
          ]
        }
      ]
    }
  }
}

Sample Response

{
  "id": "providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule",
  "name": "testRule",
  "type": "Microsoft.CostManagement/costAllocationRules",
  "properties": {
    "description": "This is a testRule",
    "createdDate": "2020-06-18T22:21:51.1287144Z",
    "updatedDate": "2020-06-18T22:21:51.1287144Z",
    "status": "Creating",
    "details": {
      "sourceResources": [
        {
          "resourceType": "Dimension",
          "name": "ResourceGroupName",
          "values": [
            "sampleRG"
          ]
        }
      ],
      "targetResources": [
        {
          "resourceType": "Dimension",
          "policyType": "FixedProportion",
          "name": "ResourceGroupName",
          "values": [
            {
              "name": "destinationRG",
              "percentage": 50
            },
            {
              "name": "destinationRG2",
              "percentage": 50
            }
          ]
        }
      ]
    }
  }
}
{
  "id": "providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule",
  "name": "testRule",
  "type": "Microsoft.CostManagement/costAllocationRules",
  "properties": {
    "description": "This is a testRule",
    "createdDate": "2020-06-18T22:21:51.1287144Z",
    "updatedDate": "2020-06-18T22:21:51.1287144Z",
    "status": "Creating",
    "details": {
      "sourceResources": [
        {
          "resourceType": "Dimension",
          "name": "ResourceGroupName",
          "values": [
            "sampleRG"
          ]
        }
      ],
      "targetResources": [
        {
          "resourceType": "Dimension",
          "policyType": "FixedProportion",
          "name": "ResourceGroupName",
          "values": [
            {
              "name": "destinationRG",
              "percentage": 50
            },
            {
              "name": "destinationRG2",
              "percentage": 50
            }
          ]
        }
      ]
    }
  }
}

CostAllocationRulesCreateTag

Sample Request

PUT https://management.azure.com/providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule?api-version=2023-11-01

{
  "properties": {
    "description": "This is a testRule",
    "status": "Active",
    "details": {
      "sourceResources": [
        {
          "resourceType": "Tag",
          "name": "category",
          "values": [
            "devops"
          ]
        }
      ],
      "targetResources": [
        {
          "resourceType": "Dimension",
          "policyType": "FixedProportion",
          "name": "ResourceGroupName",
          "values": [
            {
              "name": "destinationRG",
              "percentage": 33.33
            },
            {
              "name": "destinationRG2",
              "percentage": 33.33
            },
            {
              "name": "destinationRG3",
              "percentage": 33.34
            }
          ]
        }
      ]
    }
  }
}

Sample Response

{
  "id": "providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule",
  "name": "testRule",
  "type": "Microsoft.CostManagement/costAllocationRules",
  "properties": {
    "description": "This is a testRule",
    "createdDate": "2020-06-18T22:21:51.1287144Z",
    "updatedDate": "2020-06-18T22:21:51.1287144Z",
    "status": "Creating",
    "details": {
      "sourceResources": [
        {
          "resourceType": "Dimension",
          "name": "ResourceGroupName",
          "values": [
            "sampleRG"
          ]
        }
      ],
      "targetResources": [
        {
          "resourceType": "Dimension",
          "policyType": "FixedProportion",
          "name": "ResourceGroupName",
          "values": [
            {
              "name": "destinationRG",
              "percentage": 50
            },
            {
              "name": "destinationRG2",
              "percentage": 50
            }
          ]
        }
      ]
    }
  }
}
{
  "id": "providers/Microsoft.Billing/billingAccounts/100/providers/Microsoft.CostManagement/costAllocationRules/testRule",
  "name": "testRule",
  "type": "Microsoft.CostManagement/costAllocationRules",
  "properties": {
    "description": "This is a testRule",
    "createdDate": "2020-06-18T22:21:51.1287144Z",
    "updatedDate": "2020-06-18T22:21:51.1287144Z",
    "status": "Creating",
    "details": {
      "sourceResources": [
        {
          "resourceType": "Dimension",
          "name": "ResourceGroupName",
          "values": [
            "sampleRG"
          ]
        }
      ],
      "targetResources": [
        {
          "resourceType": "Dimension",
          "policyType": "FixedProportion",
          "name": "ResourceGroupName",
          "values": [
            {
              "name": "destinationRG",
              "percentage": 50
            },
            {
              "name": "destinationRG2",
              "percentage": 50
            }
          ]
        }
      ]
    }
  }
}

Tanımlar

Name Description
CostAllocationPolicyType

Maliyet ayırma için kullanılacak yöntem. FixedProportion, maliyetin belirtilen yüzde değerlerine göre bölüneceğini gösterir.

CostAllocationProportion

Hedef kaynaklar ve ayırma

CostAllocationResourceType

Ayırma için kullanılacak kaynak kategorisi.

CostAllocationRuleDefinition

Maliyet ayırma kuralı model tanımı

CostAllocationRuleDetails

Maliyet ayırma kuralının kaynak ayrıntıları

CostAllocationRuleProperties

Maliyet ayırma kuralının özellikleri

ErrorDetails

Hatanın ayrıntıları.

ErrorResponse

Hata yanıtı, hizmetin gelen isteği işleyemediğini gösterir. Nedeni hata iletisinde verilmiştir.

Bazı Hata yanıtları:

  • 429 TooManyRequests - İstek kısıtlandı. "x-ms-ratelimit-microsoft.consumption-retry-after" üst bilgisinde belirtilen süreyi bekledikten sonra yeniden deneyin.

  • 503 ServiceUnavailable - Hizmet geçici olarak kullanılamıyor. "Retry-After" üst bilgisinde belirtilen süre bekledikten sonra yeniden deneyin.

RuleStatus

Kuralın geçerli durumu.

SourceCostAllocationResource

Maliyet ayırma için kaynak kaynaklar

TargetCostAllocationResource

Maliyet ayırma için kaynakları hedefle.

CostAllocationPolicyType

Maliyet ayırma için kullanılacak yöntem. FixedProportion, maliyetin belirtilen yüzde değerlerine göre bölüneceğini gösterir.

Name Tür Description
FixedProportion

string

CostAllocationProportion

Hedef kaynaklar ve ayırma

Name Tür Description
name

string

Maliyet ayırma için hedef kaynak

percentage

number

Bu kaynağa ayrılacak kaynak maliyetinin yüzdesi. Bu değer iki ondalık basamak olarak belirtilebilir ve bu kuraldaki tüm kaynakların toplam yüzdesi 100,00 olarak toplanmalıdır.

CostAllocationResourceType

Ayırma için kullanılacak kaynak kategorisi.

Name Tür Description
Dimension

string

Ayırma için abonelik kimliği veya kaynak grubu adı gibi bir Azure boyutunun kullanıldığını gösterir.

Tag

string

Azure Etiket anahtarı değer çiftlerine göre maliyet ayırır.

CostAllocationRuleDefinition

Maliyet ayırma kuralı model tanımı

Name Tür Description
id

string

Kural için Azure Resource Manager Kimliği. Bu, okundu bir ony değeridir.

name

string

Kuralın adı. Bu salt okunur bir değerdir.

properties

CostAllocationRuleProperties

Maliyet ayırma kuralı özellikleri

type

string

Kuralın kaynak türü. Bu, Microsoft.CostManagement/CostAllocationRule'un salt okunur değeridir.

CostAllocationRuleDetails

Maliyet ayırma kuralının kaynak ayrıntıları

Name Tür Description
sourceResources

SourceCostAllocationResource[]

Maliyet ayırma için kaynak kaynaklar. Şu anda, bu liste birden fazla öğe içeremez.

targetResources

TargetCostAllocationResource[]

Maliyet ayırma için kaynakları hedefle. Şu anda, bu liste birden fazla öğe içeremez.

CostAllocationRuleProperties

Maliyet ayırma kuralının özellikleri

Name Tür Description
createdDate

string

Kuralın oluşturulduğu saat. Aynı kaynağın maliyetini değiştiren kurallar, oluşturma sırasına göre uygulanır.

description

string

Maliyet ayırma kuralının açıklaması.

details

CostAllocationRuleDetails

Maliyet ayırma kuralı için kaynak bilgileri

status

RuleStatus

Kuralın durumu

updatedDate

string

Kuralın en son güncelleştirildiği zaman.

ErrorDetails

Hatanın ayrıntıları.

Name Tür Description
code

string

Hata kodu.

message

string

İşlemin neden başarısız olduğunu belirten hata iletisi.

ErrorResponse

Hata yanıtı, hizmetin gelen isteği işleyemediğini gösterir. Nedeni hata iletisinde verilmiştir.

Bazı Hata yanıtları:

  • 429 TooManyRequests - İstek kısıtlandı. "x-ms-ratelimit-microsoft.consumption-retry-after" üst bilgisinde belirtilen süreyi bekledikten sonra yeniden deneyin.

  • 503 ServiceUnavailable - Hizmet geçici olarak kullanılamıyor. "Retry-After" üst bilgisinde belirtilen süre bekledikten sonra yeniden deneyin.

Name Tür Description
error

ErrorDetails

Hatanın ayrıntıları.

RuleStatus

Kuralın geçerli durumu.

Name Tür Description
Active

string

Kural kaydedilir ve maliyet ayırmayı etkiler.

NotActive

string

Kural kaydedilir ancak maliyetleri ayırmak için kullanılmaz.

Processing

string

Kural kaydedilir ve maliyet ayırma güncelleştiriliyor. Bir put isteğinde gönderilemeyen salt okunur değer.

SourceCostAllocationResource

Maliyet ayırma için kaynak kaynaklar

Name Tür Description
name

string

Kaynak türü boyut ise, bunun ResourceGroupName veya SubscriptionId olması gerekir. Kaynak türü etiketse, bu geçerli bir Azure etiketi olmalıdır

resourceType

CostAllocationResourceType

Bu maliyet ayırma kuralında yer alan kaynakların türü

values

string[]

Maliyet ayırma için kaynak kaynaklar. Bu liste 25'ten fazla değer içeremez.

TargetCostAllocationResource

Maliyet ayırma için kaynakları hedefle.

Name Tür Description
name

string

Kaynak türü boyut ise, bunun ResourceGroupName veya SubscriptionId olması gerekir. Kaynak türü etiketse, bu geçerli bir Azure etiketi olmalıdır

policyType

CostAllocationPolicyType

Kural için maliyet ayırma yöntemi

resourceType

CostAllocationResourceType

Bu maliyet ayırma kuralında yer alan kaynakların türü

values

CostAllocationProportion[]

Maliyet ayırma için kaynakları hedefle. Bu liste 25'ten fazla değer içeremez.