Возвращает сведения об указанной подписке.
GET https://management.azure.com/subscriptions/{subscriptionId}?api-version=2016-06-01
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
subscriptionId
|
path |
True
|
string
|
Идентификатор целевой подписки.
|
api-version
|
query |
True
|
string
|
Версия API, используемая для операции.
|
Ответы
Имя |
Тип |
Описание |
200 OK
|
Subscription
|
ОК — возвращает сведения о подписке.
|
Безопасность
azure_auth
Поток OAuth2 в Azure Active Directory
Тип:
oauth2
Flow:
implicit
URL-адрес авторизации:
https://login.microsoftonline.com/common/oauth2/authorize
Области
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
getSubscription
Образец запроса
GET https://management.azure.com/subscriptions/83aa47df-e3e9-49ff-877b-94304bf3d3ad?api-version=2016-06-01
/**
* Samples for Subscriptions Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/getSubscription.
* json
*/
/**
* Sample code: getSubscription.
*
* @param manager Entry point to SubscriptionManager.
*/
public static void getSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) {
manager.subscriptions().getWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad",
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.subscription import SubscriptionClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-subscription
# 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="83aa47df-e3e9-49ff-877b-94304bf3d3ad",
)
print(response)
# x-ms-original-file: specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-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 armsubscription_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/subscription/armsubscription"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/getSubscription.json
func ExampleSubscriptionsClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsubscription.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewSubscriptionsClient().Get(ctx, "83aa47df-e3e9-49ff-877b-94304bf3d3ad", 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 = armsubscription.Subscription{
// AuthorizationSource: to.Ptr("Legacy"),
// DisplayName: to.Ptr("Subscription2"),
// ID: to.Ptr("/subscriptions/83aa47df-e3e9-49ff-877b-94304bf3d3ad"),
// State: to.Ptr(armsubscription.SubscriptionStateEnabled),
// SubscriptionID: to.Ptr("83aa47df-e3e9-49ff-877b-94304bf3d3ad"),
// SubscriptionPolicies: &armsubscription.Policies{
// LocationPlacementID: to.Ptr("Internal_2014-09-01"),
// QuotaID: to.Ptr("Internal_2014-09-01"),
// SpendingLimit: to.Ptr(armsubscription.SpendingLimitOff),
// },
// }
}
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-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/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/getSubscription.json
*/
async function getSubscription() {
const subscriptionId = "83aa47df-e3e9-49ff-877b-94304bf3d3ad";
const credential = new DefaultAzureCredential();
const client = new SubscriptionClient(credential);
const result = await client.subscriptions.get(subscriptionId);
console.log(result);
}
getSubscription().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
Пример ответа
{
"id": "/subscriptions/83aa47df-e3e9-49ff-877b-94304bf3d3ad",
"authorizationSource": "Legacy",
"subscriptionId": "83aa47df-e3e9-49ff-877b-94304bf3d3ad",
"displayName": "Subscription2",
"state": "Enabled",
"subscriptionPolicies": {
"locationPlacementId": "Internal_2014-09-01",
"quotaId": "Internal_2014-09-01",
"spendingLimit": "Off"
}
}
Определения
spendingLimit
Перечисление
Предельная сумма расходов на подписку.
Значение |
Описание |
CurrentPeriodOff
|
|
Off
|
|
On
|
|
Subscription
Object
Информация о подписке.
Имя |
Тип |
Описание |
authorizationSource
|
string
|
Источник авторизации запроса. Допустимые значения — это одно или несколько сочетаний устаревших версий, RoleBased, Bypassed, Direct и Management. Например, "Legacy, RoleBased".
|
displayName
|
string
|
Отображаемое имя подписки.
|
id
|
string
|
Полный идентификатор подписки. Например, /subscriptions/00000000-0000-0000-0000-00000000000000.
|
state
|
SubscriptionState
|
Состояние подписки. Возможные значения: Enabled, Warned, PastDue, Disabled и Deleted.
|
subscriptionId
|
string
|
Идентификатор подписки.
|
subscriptionPolicies
|
SubscriptionPolicies
|
Политики подписки.
|
tags
|
object
|
Теги для подписки
|
tenantId
|
string
|
Идентификатор клиента. Например, 000000000-0000-0000-0000000000000000.
|
SubscriptionPolicies
Object
Политики подписок.
Имя |
Тип |
Описание |
locationPlacementId
|
string
|
Идентификатор расположения подписки. Идентификатор указывает, какие регионы видны для подписки. Например, подписка с идентификатором размещения расположения Public_2014-09-01 имеет доступ к общедоступным регионам Azure.
|
quotaId
|
string
|
Идентификатор квоты подписки.
|
spendingLimit
|
spendingLimit
|
Предельная сумма расходов на подписку.
|
SubscriptionState
Перечисление
Состояние подписки. Возможные значения: Enabled, Warned, PastDue, Disabled и Deleted.
Значение |
Описание |
Deleted
|
|
Disabled
|
|
Enabled
|
|
PastDue
|
|
Warned
|
|