Hiermee worden gegevens over een opgegeven abonnement opgehaald.
GET https://management.azure.com/subscriptions/{subscriptionId}?api-version=2022-12-01
URI-parameters
Name |
In |
Vereist |
Type |
Description |
subscriptionId
|
path |
True
|
string
|
De id van het doelabonnement.
|
api-version
|
query |
True
|
string
|
De API-versie die voor deze bewerking moet worden gebruikt.
|
Antwoorden
Name |
Type |
Description |
200 OK
|
Subscription
|
OK: retourneert informatie over het abonnement.
|
Other Status Codes
|
CloudError
|
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.
|
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
Name |
Description |
user_impersonation
|
uw gebruikersaccount imiteren
|
Voorbeelden
GetASingleSubscription
Voorbeeldaanvraag
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
Voorbeeldrespons
{
"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"
}
}
Definities
CloudError
Een foutreactie voor een resourcebeheeraanvraag.
Name |
Type |
Description |
error
|
ErrorResponse
|
Foutreactie
Algemene foutreactie voor alle Azure Resource Manager API's om foutdetails voor mislukte bewerkingen te retourneren. (Dit volgt ook de OData-foutreactieindeling.)
|
ErrorAdditionalInfo
Aanvullende informatie over de resourcebeheerfout.
Name |
Type |
Description |
info
|
object
|
De aanvullende informatie.
|
type
|
string
|
Het type aanvullende informatie.
|
ErrorDetail
De foutdetails.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Aanvullende informatie over de fout.
|
code
|
string
|
De foutcode.
|
details
|
ErrorDetail[]
|
De foutdetails.
|
message
|
string
|
Het foutbericht.
|
target
|
string
|
Het foutdoel.
|
ErrorResponse
Foutreactie
Name |
Type |
Description |
error
|
ErrorDetail
|
Het foutobject.
|
ManagedByTenant
Informatie over een tenant die het abonnement beheert.
Name |
Type |
Description |
tenantId
|
string
|
De tenant-id van de beherende tenant. Dit is een GUID.
|
spendingLimit
De bestedingslimiet van het abonnement.
Name |
Type |
Description |
CurrentPeriodOff
|
string
|
|
Off
|
string
|
|
On
|
string
|
|
Subscription
Abonnementsgegevens.
Name |
Type |
Description |
authorizationSource
|
string
|
De autorisatiebron van de aanvraag. Geldige waarden zijn een of meer combinaties van verouderd, op rollen gebaseerd, overgeslagen, direct en beheer. Bijvoorbeeld 'Verouderd, RoleBased'.
|
displayName
|
string
|
De weergavenaam van het abonnement.
|
id
|
string
|
De volledig gekwalificeerde id voor het abonnement. Bijvoorbeeld /subscriptions/8d65815f-a5b6-402f-9298-045155da7d74
|
managedByTenants
|
ManagedByTenant[]
|
Een matrix met de tenants die het abonnement beheren.
|
state
|
SubscriptionState
|
De abonnementsstatus. Mogelijke waarden zijn Enabled, Warned, PastDue, Disabled en Deleted.
|
subscriptionId
|
string
|
De abonnements-id.
|
subscriptionPolicies
|
SubscriptionPolicies
|
Het abonnementsbeleid.
|
tags
|
object
|
De tags die zijn gekoppeld aan het abonnement.
|
tenantId
|
string
|
De tenant-id van het abonnement.
|
SubscriptionPolicies
Abonnementsbeleid.
Name |
Type |
Description |
locationPlacementId
|
string
|
De locatielocatie-id van het abonnement. De id geeft aan welke regio's zichtbaar zijn voor een abonnement. Een abonnement met de locatieplaatsing-id Public_2014-09-01 heeft bijvoorbeeld toegang tot openbare Azure-regio's.
|
quotaId
|
string
|
De quotum-id van het abonnement.
|
spendingLimit
|
spendingLimit
|
De bestedingslimiet van het abonnement.
|
SubscriptionState
De abonnementsstatus. Mogelijke waarden zijn Enabled, Warned, PastDue, Disabled en Deleted.
Name |
Type |
Description |
Deleted
|
string
|
|
Disabled
|
string
|
|
Enabled
|
string
|
|
PastDue
|
string
|
|
Warned
|
string
|
|