{
  "openapi": "3.0.0",
  "info": {
    "description": "Subscription client provides an interface to create and manage Azure subscriptions programmatically.",
    "title": "SubscriptionClient",
    "version": "2018-11-01-preview",
    "x-jentic-source-url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/subscription/resource-manager/Microsoft.Subscription/preview/2018-11-01-preview/subscriptions.json"
  },
  "servers": [
    {
      "url": "https://management.azure.com/"
    }
  ],
  "paths": {
    "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription": {
      "post": {
        "parameters": [
          {
            "description": "The name of the Microsoft Customer Agreement billing account for which you want to create the subscription.",
            "in": "path",
            "name": "billingAccountName",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The name of the billing profile in the billing account for which you want to create the subscription.",
            "in": "path",
            "name": "billingProfileName",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The name of the invoice section in the billing account for which you want to create the subscription.",
            "in": "path",
            "name": "invoiceSectionName",
            "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": "integer"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "description": "The operation to create a new WebDirect or EA Azure subscription.",
        "operationId": "SubscriptionFactory_CreateSubscription",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModernSubscriptionCreationParameters"
              }
            }
          },
          "description": "The subscription creation parameters.",
          "required": true
        },
        "x-ms-examples": {
          "createSubscription": {
            "$ref": "./examples/createSubscription.json"
          }
        },
        "x-ms-long-running-operation": true
      }
    },
    "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription": {
      "post": {
        "parameters": [
          {
            "description": "The name of the Microsoft Customer Agreement billing account for which you want to create the subscription.",
            "in": "path",
            "name": "billingAccountName",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The name of the customer.",
            "in": "path",
            "name": "customerName",
            "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": "integer"
                }
              }
            }
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error response describing why the operation failed."
          }
        },
        "description": "The operation to create a new CSP subscription.",
        "operationId": "SubscriptionFactory_CreateCspSubscription",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModernCspSubscriptionCreationParameters"
              }
            }
          },
          "description": "The subscription creation parameters.",
          "required": true
        },
        "x-ms-examples": {
          "createSubscription": {
            "$ref": "./examples/createCspSubscription.json"
          }
        },
        "x-ms-long-running-operation": true
      }
    },
    "/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": {
                  "type": "integer"
                }
              }
            }
          }
        },
        "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 2018-11-01-preview",
        "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"
      },
      "ModernCspSubscriptionCreationParameters": {
        "description": "The parameters required to create a new CSP subscription.",
        "properties": {
          "displayName": {
            "description": "The friendly name of the subscription.",
            "type": "string"
          },
          "resellerId": {
            "description": "Reseller ID, basically MPN Id.",
            "type": "string"
          },
          "serviceProviderId": {
            "description": "Service provider ID, basically MPN Id.",
            "type": "string"
          },
          "skuId": {
            "description": "The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription.  Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest.",
            "type": "string"
          }
        },
        "required": [
          "displayName",
          "skuId"
        ],
        "type": "object"
      },
      "ModernSubscriptionCreationParameters": {
        "description": "The parameters required to create a new subscription.",
        "properties": {
          "additionalParameters": {
            "additionalProperties": {
              "type": "object"
            },
            "description": "Additional, untyped parameters to support custom subscription creation scenarios.",
            "type": "object"
          },
          "billingProfileId": {
            "description": "The ARM ID of the billing profile for which you want to create the subscription.",
            "type": "string"
          },
          "costCenter": {
            "description": "If set, the cost center will show up on the Azure usage and charges file.",
            "type": "string"
          },
          "displayName": {
            "description": "The friendly name of the subscription.",
            "type": "string"
          },
          "managementGroupId": {
            "description": "The identifier of the management group to which this subscription will be associated.",
            "type": "string"
          },
          "owner": {
            "$ref": "#/components/schemas/AdPrincipal",
            "description": "If specified, the AD principal will get owner access to the subscription, along with the user who is performing the create subscription operation"
          },
          "skuId": {
            "description": "The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription.  Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest.",
            "type": "string"
          }
        },
        "required": [
          "displayName",
          "billingProfileId",
          "skuId"
        ],
        "type": "object"
      },
      "Operation": {
        "description": "REST API operation",
        "properties": {
          "display": {
            "description": "The object that represents the operation.",
            "properties": {
              "operation": {
                "description": "Operation type: Read, write, delete, etc.",
                "type": "string"
              },
              "provider": {
                "description": "Service provider: Microsoft.Subscription",
                "type": "string"
              },
              "resource": {
                "description": "Resource on which the operation is performed: Profile, endpoint, etc.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "name": {
            "description": "Operation name: {provider}/{resource}/{operation}",
            "type": "string"
          }
        },
        "type": "object"
      },
      "OperationListResult": {
        "description": "Result of the request to list operations. It contains a list of operations and a URL link to get the next set of results.",
        "properties": {
          "nextLink": {
            "description": "URL to get the next set of operation list results if there are any.",
            "type": "string"
          },
          "value": {
            "description": "List of operations.",
            "items": {
              "$ref": "#/components/schemas/Operation"
            },
            "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"
      ]
    }
  ]
}