{
  "openapi": "3.0.0",
  "info": {
    "description": "Subscription client provides an interface to create and manage Azure subscriptions programmatically.",
    "title": "SubscriptionClient",
    "version": "2018-03-01-preview",
    "x-jentic-source-url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/subscription/resource-manager/Microsoft.Subscription/preview/2018-03-01-preview/subscriptions.json"
  },
  "servers": [
    {
      "url": "https://management.azure.com/"
    }
  ],
  "paths": {
    "/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription": {
      "post": {
        "parameters": [
          {
            "description": "The name of the enrollment account to which the subscription will be billed.",
            "in": "path",
            "name": "enrollmentAccountName",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/apiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionCreationResult"
                }
              }
            },
            "description": "Normal response for a successful query. The response body will contain the data that matches the filters specified in the query parameters."
          },
          "202": {
            "description": "Accepted. Subscription creation is in progress.",
            "headers": {
              "Location": {
                "description": "GET this URL to retrieve the status of the asynchronous operation.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "The amount of delay to use while the status of the operation is checked. The value is expressed in seconds.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "description": "Creates an Azure subscription",
        "operationId": "SubscriptionFactory_CreateSubscriptionInEnrollmentAccount",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionCreationParameters"
              }
            }
          },
          "description": "The subscription creation parameters.",
          "required": true
        },
        "x-ms-examples": {
          "createSubscription": {
            "$ref": "./examples/createSubscription.json"
          }
        },
        "x-ms-long-running-operation": true
      }
    },
    "/providers/Microsoft.Subscription/subscriptionOperations": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/apiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionOperationListResult"
                }
              }
            },
            "description": "OK. The request has succeeded."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "description": "Lists all of the available pending Microsoft.Subscription API operations.",
        "operationId": "SubscriptionOperations_List",
        "x-ms-examples": {
          "getPendingSubscriptionOperations": {
            "$ref": "./examples/getSubscriptionOperations.json"
          }
        }
      }
    },
    "/providers/Microsoft.Subscription/subscriptionOperations/{operationId}": {
      "get": {
        "parameters": [
          {
            "description": "The operation ID, which can be found from the Location field in the generate recommendation response header.",
            "in": "path",
            "name": "operationId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/apiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionCreationResult"
                }
              }
            },
            "description": "Successful completion of the asynchronous operation"
          },
          "202": {
            "description": "Accepted. Subscription update is in progress.",
            "headers": {
              "Location": {
                "description": "The URL where the status of the asynchronous operation can be checked.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "The amount of delay to use while the status of the operation is checked. The value is expressed in seconds.",
                "schema": {
                  "format": "int64",
                  "type": "integer"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseBody"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "description": "Get the status of the pending Microsoft.Subscription API operations.",
        "operationId": "SubscriptionOperation_Get",
        "x-ms-examples": {
          "getPendingSubscriptionOperations": {
            "$ref": "./examples/getSubscriptionOperation.json"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "apiVersionParameter": {
        "description": "Version of the API to be used with the client request. Current version is 2015-06-01",
        "in": "query",
        "name": "api-version",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "AdPrincipal": {
        "description": "Active Directory Principal who’ll get owner access on the new subscription.",
        "properties": {
          "objectId": {
            "description": "Object id of the Principal",
            "type": "string"
          }
        },
        "required": [
          "objectId"
        ],
        "type": "object"
      },
      "ErrorResponse": {
        "description": "Describes the format of Error response.",
        "properties": {
          "code": {
            "description": "Error code",
            "type": "string"
          },
          "message": {
            "description": "Error message indicating why the operation failed.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ErrorResponseBody": {
        "description": "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorResponse",
            "description": "The details of the error."
          }
        },
        "type": "object"
      },
      "SubscriptionCreationParameters": {
        "description": "Subscription Creation Parameters required to create a new Azure subscription.",
        "properties": {
          "additionalParameters": {
            "additionalProperties": {
              "type": "object"
            },
            "description": "Additional, untyped parameters to support custom subscription creation scenarios.",
            "type": "object"
          },
          "displayName": {
            "description": "The display name of the subscription.",
            "type": "string"
          },
          "offerType": {
            "description": "The offer type of the subscription. For example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are available. Only valid when creating a subscription in a enrollment account scope.",
            "enum": [
              "MS-AZR-0017P",
              "MS-AZR-0148P"
            ],
            "type": "string",
            "x-ms-enum": {
              "modelAsString": true,
              "name": "offerType"
            }
          },
          "owners": {
            "description": "The list of principals that should be granted Owner access on the subscription. Principals should be of type User, Service Principal or Security Group.",
            "items": {
              "$ref": "#/components/schemas/AdPrincipal"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SubscriptionCreationResult": {
        "description": "The created subscription object.",
        "properties": {
          "subscriptionLink": {
            "description": "The link to the new subscription. Use this link to check the status of subscription creation operation.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SubscriptionOperation": {
        "description": "status of the subscription POST operation.",
        "properties": {
          "id": {
            "description": "The operation Id.",
            "readOnly": true,
            "type": "string"
          },
          "status": {
            "description": "Status of the pending subscription",
            "type": "string"
          },
          "statusDetail": {
            "description": "Status Detail of the pending subscription",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SubscriptionOperationListResult": {
        "description": "A list of pending subscription operations.",
        "properties": {
          "value": {
            "description": "A list of pending SubscriptionOperations",
            "items": {
              "$ref": "#/components/schemas/SubscriptionOperation"
            },
            "type": "array"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "azure_auth": {
        "description": "Azure Active Directory OAuth2 Flow",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
            "scopes": {
              "user_impersonation": "impersonate your user account"
            }
          }
        },
        "type": "oauth2"
      }
    }
  },
  "security": [
    {
      "azure_auth": [
        "user_impersonation"
      ]
    }
  ]
}