Ruft Details zu einem angegebenen Abonnement ab.
GET https://management.azure.com/subscriptions/{subscriptionId}?api-version=2022-12-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
subscriptionId
|
path |
True
|
string
|
Hierbei handelt es sich um die ID des Zielabonnements.
|
api-version
|
query |
True
|
string
|
Hierbei handelt es sich um die für diesen Vorgang zu verwendende API-Version.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
Subscription
|
OK: Gibt Informationen zum Abonnement zurück.
|
Other Status Codes
|
CloudError
|
Fehlerantwort mit Beschreibung des Grunds für den Fehler.
|
Sicherheit
azure_auth
Azure Active Directory-OAuth2-Flow
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel Ihres Benutzerkontos
|
Beispiele
GetASingleSubscription
Beispielanforderung
GET https://management.azure.com/subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05?api-version=2022-12-01
/**
* Samples for Subscriptions Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.json
*/
/**
* Sample code: GetASingleSubscription.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getASingleSubscription(com.azure.resourcemanager.AzureResourceManager azure) {
azure.genericResources().manager().subscriptionClient().getSubscriptions()
.getWithResponse("291bba3f-e0a5-47bc-a099-3bdcb2a50a05", 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.resource import SubscriptionClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource
# USAGE
python get_subscription.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 = SubscriptionClient(
credential=DefaultAzureCredential(),
)
response = client.subscriptions.get(
subscription_id="291bba3f-e0a5-47bc-a099-3bdcb2a50a05",
)
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.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 armsubscriptions_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.json
func ExampleClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewClient().Get(ctx, "291bba3f-e0a5-47bc-a099-3bdcb2a50a05", 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.Subscription = armsubscriptions.Subscription{
// AuthorizationSource: to.Ptr("Bypassed"),
// DisplayName: to.Ptr("Example Subscription"),
// ID: to.Ptr("/subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05"),
// ManagedByTenants: []*armsubscriptions.ManagedByTenant{
// {
// TenantID: to.Ptr("8f70baf1-1f6e-46a2-a1ff-238dac1ebfb7"),
// }},
// State: to.Ptr(armsubscriptions.SubscriptionStateEnabled),
// SubscriptionID: to.Ptr("291bba3f-e0a5-47bc-a099-3bdcb2a50a05"),
// SubscriptionPolicies: &armsubscriptions.SubscriptionPolicies{
// LocationPlacementID: to.Ptr("Internal_2014-09-01"),
// QuotaID: to.Ptr("Internal_2014-09-01"),
// SpendingLimit: to.Ptr(armsubscriptions.SpendingLimitOff),
// },
// Tags: map[string]*string{
// "tagKey1": to.Ptr("tagValue1"),
// "tagKey2": to.Ptr("tagValue2"),
// },
// TenantID: to.Ptr("31c75423-32d6-4322-88b7-c478bdde4858"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SubscriptionClient } = require("@azure/arm-resources-subscriptions");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets details about a specified subscription.
*
* @summary Gets details about a specified subscription.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.json
*/
async function getASingleSubscription() {
const subscriptionId = "291bba3f-e0a5-47bc-a099-3bdcb2a50a05";
const credential = new DefaultAzureCredential();
const client = new SubscriptionClient(credential);
const result = await client.subscriptions.get(subscriptionId);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.json
// this example is just showing the usage of "Subscriptions_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "291bba3f-e0a5-47bc-a099-3bdcb2a50a05";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscription = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation
SubscriptionResource result = await subscription.GetAsync();
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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": "/subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05",
"subscriptionId": "291bba3f-e0a5-47bc-a099-3bdcb2a50a05",
"tenantId": "31c75423-32d6-4322-88b7-c478bdde4858",
"displayName": "Example Subscription",
"state": "Enabled",
"subscriptionPolicies": {
"locationPlacementId": "Internal_2014-09-01",
"quotaId": "Internal_2014-09-01",
"spendingLimit": "Off"
},
"authorizationSource": "Bypassed",
"managedByTenants": [
{
"tenantId": "8f70baf1-1f6e-46a2-a1ff-238dac1ebfb7"
}
],
"tags": {
"tagKey1": "tagValue1",
"tagKey2": "tagValue2"
}
}
Definitionen
CloudError
Eine Fehlerantwort für eine Ressourcenverwaltungsanforderung.
Name |
Typ |
Beschreibung |
error
|
ErrorResponse
|
Fehlerantwort
Allgemeine Fehlerantwort für alle Azure Resource Manager-APIs, zur Rückgabe von Fehlerdetails für fehlgeschlagene Vorgänge. (Dies folgt auch dem OData-Fehlerantwortformat.).
|
ErrorAdditionalInfo
Zusätzliche Informationen zum Ressourcenverwaltungsfehler.
Name |
Typ |
Beschreibung |
info
|
object
|
Zusätzliche Informationen.
|
type
|
string
|
Typ der zusätzlichen Informationen.
|
ErrorDetail
Die Fehlerdetails.
Name |
Typ |
Beschreibung |
additionalInfo
|
ErrorAdditionalInfo[]
|
Die zusätzlichen Fehlerinformationen.
|
code
|
string
|
Der Fehlercode.
|
details
|
ErrorDetail[]
|
Die Fehlerdetails.
|
message
|
string
|
Die Fehlermeldung.
|
target
|
string
|
Das Fehlerziel.
|
ErrorResponse
Fehlerantwort
Name |
Typ |
Beschreibung |
error
|
ErrorDetail
|
Das Fehlerobjekt.
|
ManagedByTenant
Informationen zu einem Mandanten, der das Abonnement verwaltet.
Name |
Typ |
Beschreibung |
tenantId
|
string
|
Die Mandanten-ID des verwaltender Mandanten. Dies ist eine GUID.
|
spendingLimit
Das Ausgabenlimit für Abonnements.
Name |
Typ |
Beschreibung |
CurrentPeriodOff
|
string
|
|
Off
|
string
|
|
On
|
string
|
|
Subscription
Abonnementinformationen
Name |
Typ |
Beschreibung |
authorizationSource
|
string
|
Die Autorisierungsquelle der Anforderung. Gültige Werte sind mindestens eine Kombination aus Legacy, RoleBased, Bypassed, Direct und Management. Beispiel: "Legacy, RoleBased".
|
displayName
|
string
|
Der Anzeigename des Abonnements.
|
id
|
string
|
Die vollqualifizierte ID für das Abonnement. Beispiel: /subscriptions/8d65815f-a5b6-402f-9298-045155da7d74
|
managedByTenants
|
ManagedByTenant[]
|
Ein Array, das die Mandanten enthält, die das Abonnement verwalten.
|
state
|
SubscriptionState
|
Der Abonnementstatus. Mögliche Werte sind Enabled, Warned, PastDue, Disabled und Deleted.
|
subscriptionId
|
string
|
Die Abonnement-ID.
|
subscriptionPolicies
|
SubscriptionPolicies
|
Die Abonnementrichtlinien.
|
tags
|
object
|
Die Tags, die dem Abonnement angefügt sind.
|
tenantId
|
string
|
Die Abonnementmandanten-ID.
|
SubscriptionPolicies
Abonnementrichtlinien.
Name |
Typ |
Beschreibung |
locationPlacementId
|
string
|
Die Platzierungs-ID des Abonnementspeicherorts. Die ID gibt an, welche Regionen für ein Abonnement sichtbar sind. Beispielsweise hat ein Abonnement mit der Standortplatzierungs-ID Public_2014-09-01 Zugriff auf öffentliche Azure-Regionen.
|
quotaId
|
string
|
Die Abonnementkontingent-ID.
|
spendingLimit
|
spendingLimit
|
Das Ausgabenlimit für Abonnements.
|
SubscriptionState
Der Abonnementstatus. Mögliche Werte sind Enabled, Warned, PastDue, Disabled und Deleted.
Name |
Typ |
Beschreibung |
Deleted
|
string
|
|
Disabled
|
string
|
|
Enabled
|
string
|
|
PastDue
|
string
|
|
Warned
|
string
|
|