Aktualisiert die Richtlinien für einen Kunden. Dieser Vorgang wird nur für Abrechnungskonten mit dem Vertragstyp Microsoft Partner Agreement unterstützt.
PUT https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default?api-version=2020-05-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
billingAccountName
|
path |
True
|
string
|
Die ID, die ein Abrechnungskonto eindeutig identifiziert.
|
customerName
|
path |
True
|
string
|
Die ID, die einen Kunden eindeutig identifiziert.
|
api-version
|
query |
True
|
string
|
Die Version der API, die mit der Clientanforderung verwendet werden soll. Die aktuelle Version ist 2020-05-01.
|
Anforderungstext
Name |
Typ |
Beschreibung |
properties.viewCharges
|
ViewCharges
|
Die Richtlinie, die steuert, ob die Benutzer in der Organisation des Kunden gebührenpflichtige Preise anzeigen können.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
CustomerPolicy
|
OKAY. Die Anforderung ist erfolgreich.
|
Other Status Codes
|
ErrorResponse
|
Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist.
|
Sicherheit
azure_auth
Azure Active Directory OAuth2-Fluss.
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
UpdateCustomer
Beispielanforderung
PUT https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default?api-version=2020-05-01
{
"properties": {
"viewCharges": "NotAllowed"
}
}
import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner;
import com.azure.resourcemanager.billing.models.ViewCharges;
/** Samples for Policies UpdateCustomer. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateCustomerPolicy.json
*/
/**
* Sample code: UpdateCustomer.
*
* @param manager Entry point to BillingManager.
*/
public static void updateCustomer(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.policies()
.updateCustomerWithResponse(
"{billingAccountName}",
"{customerName}",
new CustomerPolicyInner().withViewCharges(ViewCharges.NOT_ALLOWED),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.billing import BillingManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-billing
# USAGE
python update_customer.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BillingManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.policies.update_customer(
billing_account_name="{billingAccountName}",
customer_name="{customerName}",
parameters={"properties": {"viewCharges": "NotAllowed"}},
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateCustomerPolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbilling_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateCustomerPolicy.json
func ExamplePoliciesClient_UpdateCustomer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoliciesClient().UpdateCustomer(ctx, "{billingAccountName}", "{customerName}", armbilling.CustomerPolicy{
Properties: &armbilling.CustomerPolicyProperties{
ViewCharges: to.Ptr(armbilling.ViewChargesNotAllowed),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.CustomerPolicy = armbilling.CustomerPolicy{
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/customers/policies"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default"),
// Properties: &armbilling.CustomerPolicyProperties{
// ViewCharges: to.Ptr(armbilling.ViewChargesNotAllowed),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @summary Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateCustomerPolicy.json
*/
async function updateCustomer() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const customerName = "{customerName}";
const parameters = { viewCharges: "NotAllowed" };
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.policies.updateCustomer(billingAccountName, customerName, parameters);
console.log(result);
}
updateCustomer().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default",
"name": "default",
"type": "Microsoft.Billing/billingAccounts/customers/policies",
"properties": {
"viewCharges": "NotAllowed"
}
}
Definitionen
Name |
Beschreibung |
CustomerPolicy
|
Die Richtlinie des Kunden.
|
ErrorDetails
|
Die Details des Fehlers.
|
ErrorResponse
|
Fehlerantwort gibt an, dass der Dienst die eingehende Anforderung nicht verarbeiten kann. Der Grund wird in der Fehlermeldung angegeben.
|
ErrorSubDetails
|
|
ViewCharges
|
Die Richtlinie, die steuert, ob die Benutzer in der Organisation des Kunden gebührenpflichtige Preise anzeigen können.
|
CustomerPolicy
Objekt
Die Richtlinie des Kunden.
Name |
Typ |
Beschreibung |
id
|
string
|
Ressourcen-ID.
|
name
|
string
|
Ressourcenname.
|
properties.viewCharges
|
ViewCharges
|
Die Richtlinie, die steuert, ob die Benutzer in der Organisation des Kunden gebührenpflichtige Preise anzeigen können.
|
type
|
string
|
Ressourcentyp.
|
ErrorDetails
Objekt
Die Details des Fehlers.
Name |
Typ |
Beschreibung |
code
|
string
|
Fehlercode.
|
details
|
ErrorSubDetails[]
|
Die Unterdetails des Fehlers.
|
message
|
string
|
Fehlermeldung, die angibt, warum der Vorgang fehlgeschlagen ist.
|
target
|
string
|
Das Ziel des bestimmten Fehlers.
|
ErrorResponse
Objekt
Fehlerantwort gibt an, dass der Dienst die eingehende Anforderung nicht verarbeiten kann. Der Grund wird in der Fehlermeldung angegeben.
Name |
Typ |
Beschreibung |
error
|
ErrorDetails
|
Die Details des Fehlers.
|
ErrorSubDetails
Objekt
Name |
Typ |
Beschreibung |
code
|
string
|
Fehlercode.
|
message
|
string
|
Fehlermeldung, die angibt, warum der Vorgang fehlgeschlagen ist.
|
target
|
string
|
Das Ziel des bestimmten Fehlers.
|
ViewCharges
Enumeration
Die Richtlinie, die steuert, ob die Benutzer in der Organisation des Kunden gebührenpflichtige Preise anzeigen können.
Wert |
Beschreibung |
Allowed
|
|
NotAllowed
|
|