swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities.
  title: SqlManagementClient
  version: 2017-03-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/sql/resource-manager/Microsoft.Sql/preview/2017-03-01-preview/managedInstanceAdministrators.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-managedInstanceAdministrators
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
parameters:
  ApiVersionParameter:
    description: The API version to use for the request.
    in: query
    name: api-version
    required: true
    type: string
    x-ms-parameter-location: client
  BlobAuditingPolicyNameParameter:
    description: The name of the blob auditing policy.
    enum:
      - default
    in: path
    name: blobAuditingPolicyName
    required: true
    type: string
    x-ms-parameter-location: method
  DatabaseNameParameter:
    description: The name of the database.
    in: path
    name: databaseName
    required: true
    type: string
    x-ms-parameter-location: method
  ManagedInstanceNameParameter:
    description: The name of the managed instance.
    in: path
    name: managedInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  ResourceGroupParameter:
    description: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  ServerNameParameter:
    description: The name of the server.
    in: path
    name: serverName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineContainerNameParameter:
    description: The name of the SqlVirtualMachineContainer.
    in: path
    name: sqlVirtualMachineContainerName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineInstanceNameParameter:
    description: The name of the SqlVirtualMachineInstance.
    in: path
    name: sqlVirtualMachineInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The subscription ID that identifies an Azure subscription.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: client
  VirtualClusterNameParameter:
    description: The name of the virtual cluster.
    in: path
    name: virtualClusterName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators":
    get:
      description: Gets a list of managed instance administrators.
      operationId: ManagedInstanceAdministrators_ListByInstance
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of managed instance administrators.
          schema:
            $ref: "#/definitions/ManagedInstanceAdministratorListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SubscriptionNotFound - The requested subscription was not found.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 ManagedInstanceNotInSubscriptionResourceGroup - Specified managed instance does not exist in the specified resource group and subscription.

             * 404 ResourceNotFound - The requested resource was not found.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ManagedInstanceAdministrators
      x-ms-examples:
        List administrators of managed instance:
          parameters:
            api-version: 2017-03-01-preview
            managedInstanceName: managedInstance
            resourceGroupName: Default-SQL-SouthEastAsia
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory
                    name: ActiveDirectory
                    properties:
                      administratorType: ActiveDirectory
                      login: bob@contoso.com
                      sid: 44444444-3333-2222-1111-000000000000
                      tenantId: 55555555-4444-3333-2222-111111111111
                    type: Microsoft.Sql/managedInstances/administrators
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}":
    delete:
      description: Deletes a managed instance administrator.
      operationId: ManagedInstanceAdministrators_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - description: The administrator name.
          enum:
            - ActiveDirectory
          in: path
          name: administratorName
          required: true
          type: string
          x-ms-enum:
            name: AdministratorName
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the managed instance administrator.
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 SubscriptionNotFound - The requested subscription was not found.

             * 400 InvalidManagedServerAdministratorType - Invalid administrator type specified in properties.

             * 400 InvalidResourceRequestBody - The resource or resource properties in the request body is empty or invalid.

             * 400 InvalidParameterValue - An invalid value was given to a parameter.

             * 400 InvalidLoginName - The provided login name is invalid.

             * 400 PrincipalNotFoundInTenant - AzureAD Lookup returned no results for this name.

             * 400 ManagedInstanceIsBusy - Managed Instance is busy with another request.

             * 400 InvalidPrincipalType - This principal type is not supported in Windows Azure SQL Database.

             * 400 TenantNotFoundInActiveDirectory - Tenant is not available in active directory.

             * 400 InvalidUsername - Supplied user name contains invalid characters.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 ManagedInstanceNotInSubscriptionResourceGroup - Specified managed instance does not exist in the specified resource group and subscription.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ResourceNotFound - The requested resource was not found.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 500 ActiveDirectoryLookupTimedOut - The operation could not be completed at this time. Please try again later.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ManagedInstanceAdministrators
      x-ms-examples:
        Delete administrator of managed instance:
          parameters:
            administratorName: ActiveDirectory
            api-version: 2017-03-01-preview
            managedInstanceName: managedInstance
            resourceGroupName: Default-SQL-SouthEastAsia
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "202": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a managed instance administrator.
      operationId: ManagedInstanceAdministrators_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - description: The administrator name.
          enum:
            - ActiveDirectory
          in: path
          name: administratorName
          required: true
          type: string
          x-ms-enum:
            name: AdministratorName
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the specified managed instance administrator.
          schema:
            $ref: "#/definitions/ManagedInstanceAdministrator"
        default:
          description: |-
            *** Error Responses: ***

             * 400 SubscriptionNotFound - The requested subscription was not found.

             * 400 InvalidManagedServerAdministratorType - Invalid administrator type specified in properties.

             * 400 InvalidResourceRequestBody - The resource or resource properties in the request body is empty or invalid.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 ManagedInstanceNotInSubscriptionResourceGroup - Specified managed instance does not exist in the specified resource group and subscription.

             * 404 ResourceNotFound - The requested resource was not found.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ManagedInstanceAdministrators
      x-ms-examples:
        Get administrator of managed instance:
          parameters:
            administratorName: ActiveDirectory
            api-version: 2017-03-01-preview
            managedInstanceName: managedInstance
            resourceGroupName: Default-SQL-SouthEastAsia
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory
                name: ActiveDirectory
                properties:
                  administratorType: ActiveDirectory
                  login: bob@contoso.com
                  sid: 44444444-3333-2222-1111-000000000000
                  tenantId: 55555555-4444-3333-2222-111111111111
                type: Microsoft.Sql/managedInstances/administrators
    put:
      description: Creates or updates a managed instance administrator.
      operationId: ManagedInstanceAdministrators_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ManagedInstanceNameParameter"
        - description: The requested administrator name.
          enum:
            - ActiveDirectory
          in: path
          name: administratorName
          required: true
          type: string
          x-ms-enum:
            name: AdministratorName
        - description: The requested administrator parameters.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ManagedInstanceAdministrator"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the managed instance administrator.
          schema:
            $ref: "#/definitions/ManagedInstanceAdministrator"
        "201":
          description: Successfully created the managed instance administrator.
          schema:
            $ref: "#/definitions/ManagedInstanceAdministrator"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 SubscriptionNotFound - The requested subscription was not found.

             * 400 InvalidManagedServerAdministratorType - Invalid administrator type specified in properties.

             * 400 InvalidResourceRequestBody - The resource or resource properties in the request body is empty or invalid.

             * 400 InvalidParameterValue - An invalid value was given to a parameter.

             * 400 InvalidLoginName - The provided login name is invalid.

             * 400 PrincipalNotFoundInTenant - AzureAD Lookup returned no results for this name.

             * 400 ManagedInstanceIsBusy - Managed Instance is busy with another request.

             * 400 InvalidPrincipalType - This principal type is not supported in Windows Azure SQL Database.

             * 400 TenantNotFoundInActiveDirectory - Tenant is not available in active directory.

             * 400 InvalidUsername - Supplied user name contains invalid characters.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 ManagedInstanceNotInSubscriptionResourceGroup - Specified managed instance does not exist in the specified resource group and subscription.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ResourceNotFound - The requested resource was not found.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 500 ActiveDirectoryLookupTimedOut - The operation could not be completed at this time. Please try again later.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ManagedInstanceAdministrators
      x-ms-examples:
        Create administrator of managed instance:
          parameters:
            administratorName: ActiveDirectory
            api-version: 2017-03-01-preview
            managedInstanceName: managedInstance
            parameters:
              properties:
                administratorType: ActiveDirectory
                login: bob@contoso.com
                sid: 44444444-3333-2222-1111-000000000000
                tenantId: 55555555-4444-3333-2222-111111111111
            resourceGroupName: Default-SQL-SouthEastAsia
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory
                name: ActiveDirectory
                properties:
                  administratorType: ActiveDirectory
                  login: bob@contoso.com
                  sid: 44444444-3333-2222-1111-000000000000
                  tenantId: 55555555-4444-3333-2222-111111111111
                type: Microsoft.Sql/managedInstances/administrators
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory
                name: ActiveDirectory
                properties:
                  administratorType: ActiveDirectory
                  login: bob@contoso.com
                  sid: 44444444-3333-2222-1111-000000000000
                  tenantId: 55555555-4444-3333-2222-111111111111
                type: Microsoft.Sql/managedInstances/administrators
            "202": {}
        Update administrator of managed instance:
          parameters:
            administratorName: ActiveDirectory
            api-version: 2017-03-01-preview
            managedInstanceName: managedInstance
            parameters:
              properties:
                administratorType: ActiveDirectory
                login: bob@contoso.com
                sid: 44444444-3333-2222-1111-000000000000
                tenantId: 55555555-4444-3333-2222-111111111111
            resourceGroupName: Default-SQL-SouthEastAsia
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory
                name: ActiveDirectory
                properties:
                  administratorType: ActiveDirectory
                  login: bob@contoso.com
                  sid: 44444444-3333-2222-1111-000000000000
                  tenantId: 55555555-4444-3333-2222-111111111111
                type: Microsoft.Sql/managedInstances/administrators
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory
                name: ActiveDirectory
                properties:
                  administratorType: ActiveDirectory
                  login: bob@contoso.com
                  sid: 44444444-3333-2222-1111-000000000000
                  tenantId: 55555555-4444-3333-2222-111111111111
                type: Microsoft.Sql/managedInstances/administrators
            "202": {}
      x-ms-long-running-operation: true
definitions:
  ManagedInstanceAdministrator:
    allOf:
      - $ref: "#/definitions/ProxyResource"
    description: An Azure SQL managed instance administrator.
    properties:
      properties:
        $ref: "#/definitions/ManagedInstanceAdministratorProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  ManagedInstanceAdministratorListResult:
    description: A list of managed instance administrators.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/ManagedInstanceAdministrator"
        readOnly: true
        type: array
    type: object
  ManagedInstanceAdministratorProperties:
    description: The properties of a managed instance administrator.
    properties:
      administratorType:
        description: Type of the managed instance administrator.
        enum:
          - ActiveDirectory
        type: string
        x-ms-enum:
          modelAsString: true
          name: ManagedInstanceAdministratorType
      login:
        description: Login name of the managed instance administrator.
        type: string
      sid:
        description: SID (object ID) of the managed instance administrator.
        format: uuid
        type: string
      tenantId:
        description: Tenant ID of the managed instance administrator.
        format: uuid
        type: string
    required:
      - administratorType
      - login
      - sid
    type: object
  ProxyResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: ARM proxy resource.
    properties: {}
    type: object
  Resource:
    description: ARM resource.
    properties:
      id:
        description: Resource ID.
        readOnly: true
        type: string
      name:
        description: Resource name.
        readOnly: true
        type: string
      type:
        description: Resource type.
        readOnly: true
        type: string
    type: object
    x-ms-azure-resource: true
