swagger: "2.0"
schemes:
  - https
host: 169.254.169.254
basePath: /metadata
info:
  description: The Azure Instance Metadata Client
  title: InstanceMetadataClient
  version: 2018-10-01
  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/imds/data-plane/Microsoft.InstanceMetadataService/stable/2018-10-01/imds.json
      version: "2.0"
  x-preferred: false
  x-providerName: azure.com
  x-serviceName: imds
  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
security:
  - azure_auth:
      - user_impersonation
parameters:
  ApiVersionParameter:
    description: This is the API version to use.
    enum:
      - 2018-10-01
    in: query
    name: api-version
    required: true
    type: string
    x-ms-enum:
      modelAsString: true
      name: ApiVersion
  MetadataParameter:
    description: This must be set to 'true'.
    enum:
      - "true"
    in: header
    name: Metadata
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  /attested/document:
    get:
      description: Get Attested Data for the Virtual Machine.
      operationId: Attested_GetDocument
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
        - description: This is a string of up to 32 random alphanumeric characters.
          in: query
          name: nonce
          required: false
          type: string
        - $ref: "#/parameters/MetadataParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/AttestedData"
        "400":
          description: Invalid request
          schema:
            $ref: "#/definitions/ErrorResponse"
        "403":
          description: Forbidden
          schema:
            $ref: "#/definitions/ErrorResponse"
        "404":
          description: Not found
          schema:
            $ref: "#/definitions/ErrorResponse"
        "405":
          description: Method not allowed
          schema:
            $ref: "#/definitions/ErrorResponse"
        "429":
          description: Too many requests
          schema:
            $ref: "#/definitions/ErrorResponse"
        "500":
          description: Server error
          schema:
            $ref: "#/definitions/ErrorResponse"
        "503":
          description: Service unavailable
          schema:
            $ref: "#/definitions/ErrorResponse"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Get Attested Data for the VM:
          parameters:
            Metadata: "true"
            api-version: 2018-10-01
            nonce: abcde12345
          responses:
            "200":
              body:
                encoding: pkcs7
                signature: MIID2gYJKoZIhvcNAQcCoIIDyzCCA8cCAQExDzANBgkqhkiG9w0BAQsFADCBggYJKoZIhvcNAQcBoHUEc3sibm9uY2UiOiIxMTExMTExMTExIiwicGxhbiI6eyJuYW1lIjoiIiwicHJvZHVjdCI6IiIsInB1Ymxpc2hlciI6IiJ9LCJ2bUlkIjoiMDJhYWI4YTQtNzRlZi00NzZlLTgxODItZjZkMmJhNDE2NmE2In2gggI/MIICOzCCAaSgAwIBAgIQQWsFjXN35oBJKFXI3QrM3TANBgkqhkiG9w0BAQQFADArMSkwJwYDVQQDEyB0ZXN0c3ViZG9tYWluLm1ldGFkYXRhLmF6dXJlLmNvbTAeFw0xODExMDgxODUzMDRaFw0xODEyMDgxODUzMDNaMCsxKTAnBgNVBAMTIHRlc3RzdWJkb21haW4ubWV0YWRhdGEuYXp1cmUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEi0FVslYnUX+MneC7ERMU4ZM88z4J80r7RPgvzxCPNhXUQlWm3cmVRZMD8kKMv7brkvEsATP7Ak60/I/XEtOga4LGCvMaQa8I/MW8IhSyp2Vj015glAiV8TeUI5DuOIOS96lQvM+G7bt23swkIwVjm1u1ViTZiKKytwpY/EGqzQIDAQABo2AwXjBcBgNVHQEEVTBTgBAt3MRgJmEoUMiPy7k06cLfoS0wKzEpMCcGA1UEAxMgdGVzdHN1YmRvbWFpbi5tZXRhZGF0YS5henVyZS5jb22CEEFrBY1zd+aASShVyN0KzN0wDQYJKoZIhvcNAQEEBQADgYEAd87qiZnRlGIFQ5IEcL/A7ru23WSQAOBsNPt70Fg1GtaEHcYshKUJFhGwXOgZ11cY5wRfrSvEKuzvhAeIZwkvzkBjC04g8sRrjN5leLY5CsKzQhjN52TUMsHhqTM58tfAnICeTddQwn6LOgfqtYH5WO+F/VbFCwPstYUqjmQEYAoxgegwgeUCAQEwPzArMSkwJwYDVQQDEyB0ZXN0c3ViZG9tYWluLm1ldGFkYXRhLmF6dXJlLmNvbQIQQWsFjXN35oBJKFXI3QrM3TANBgkqhkiG9w0BAQsFADANBgkqhkiG9w0BAQEFAASBgCbkRKmQ1MdWZPVOrX7ZBKHQUWPFrQQNdjk3KB67GkY0W0Taxut4K7D2PmiflVEwxB92pTbaZZr/dldu1k1ab1YamHcVYdgZgxIkoOWohGR0ym8oL9JHjFMEqHUbEPtDwE8X+djtDd8TVdb6LYe77IXmz/VaX4whuejlSvQXjaL
            "400":
              body:
                error: Bad request
            "403":
              body:
                error: Forbidden
            "404":
              body:
                error: Not found
            "405":
              body:
                error: Not allowed
            "429":
              body:
                error: Too many requests
            "500":
              body:
                error: Server error
            "503":
              body:
                error: Service unavailable
  /identity/info:
    get:
      description: Get information about AAD Metadata
      operationId: Identity_GetInfo
      parameters:
        - $ref: "#/parameters/MetadataParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/IdentityInfoResponse"
        "400":
          description: Invalid request
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "404":
          description: Not found
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "405":
          description: Method not allowed
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "429":
          description: Too many requests
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "500":
          description: Server error
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
      tags:
        - Get metadata information
      x-ms-examples:
        Get Identity Info for the VM:
          parameters:
            Metadata: "true"
            api-version: 2018-10-01
          responses:
            "200":
              body:
                tenantId: abd8daee-d393-4239-9377-883adda3d40f
            "400":
              body:
                error: invalid_request
                error_description: Bad request
            "404":
              body:
                error: not_found
                error_description: Not found
            "405":
              body:
                error: method_not_allowed
                error_description: Not allowed
            "429":
              body:
                error: too_many_requests
                error_description: Too many requests
            "500":
              body:
                error: server_error
                error_description: Server error
  /identity/oauth2/token:
    get:
      description: Get a Token from Azure AD
      operationId: Identity_GetToken
      parameters:
        - $ref: "#/parameters/MetadataParameter"
        - description: This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource.
          in: query
          name: resource
          required: true
          type: string
        - $ref: "#/parameters/ApiVersionParameter"
        - description: This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id.
          in: query
          name: client_id
          required: false
          type: string
        - description: This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id.
          in: query
          name: object_id
          required: false
          type: string
        - description: This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id.
          in: query
          name: msi_res_id
          required: false
          type: string
        - description: This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used.
          in: query
          name: authority
          required: false
          type: string
        - description: If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache.
          enum:
            - "true"
          in: query
          name: bypass_cache
          required: false
          type: string
          x-ms-enum:
            modelAsString: true
            name: BypassCache
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/IdentityTokenResponse"
        "400":
          description: Invalid request
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "404":
          description: Not found
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "405":
          description: Method not allowed
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "429":
          description: Too many requests
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        "500":
          description: Server error
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/IdentityErrorResponse"
      tags:
        - Get token
      x-ms-examples:
        Get Identity Token for the VM:
          parameters:
            Metadata: "true"
            api-version: 2018-10-01
            resource: https://vault.azure.net
          responses:
            "200":
              body:
                access_token: dummytoken
                client_id: be5947ed-3560-4afe-9504-59967a63f810
                expires_in: "3599"
                expires_on: "1541705014"
                ext_expires_in: "262800"
                not_before: "1508961830"
                resource: https://va
            "400":
              body:
                error: invalid_request
                error_description: Bad request
            "404":
              body:
                error: not_found
                error_description: Not found
            "405":
              body:
                error: method_not_allowed
                error_description: Not allowed
            "429":
              body:
                error: too_many_requests
                error_description: Too many requests
            "500":
              body:
                error: server_error
                error_description: Server error
  /instance:
    get:
      description: Get Instance Metadata for the Virtual Machine.
      operationId: Instances_GetMetadata
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/MetadataParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Instance"
        "400":
          description: Invalid request
          schema:
            $ref: "#/definitions/ErrorResponse"
        "403":
          description: Forbidden
          schema:
            $ref: "#/definitions/ErrorResponse"
        "404":
          description: Not found
          schema:
            $ref: "#/definitions/ErrorResponse"
        "405":
          description: Method not allowed
          schema:
            $ref: "#/definitions/ErrorResponse"
        "429":
          description: Too many requests
          schema:
            $ref: "#/definitions/ErrorResponse"
        "500":
          description: Server error
          schema:
            $ref: "#/definitions/ErrorResponse"
        "503":
          description: Service unavailable
          schema:
            $ref: "#/definitions/ErrorResponse"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Get Instance Metadata for the VM:
          parameters:
            Metadata: "true"
            api-version: 2018-10-01
          responses:
            "200":
              body:
                compute:
                  azEnvironment: AZUREPUBLICCLOUD
                  location: westus
                  name: examplevmname
                  offer: Windows
                  osType: linux
                  placementGroupId: f67c14ab-e92c-408c-ae2d-da15866ec79a
                  plan:
                    name: planName
                    product: planProduct
                    publisher: planPublisher
                  platformFaultDomain: "36"
                  platformUpdateDomain: "42"
                  publicKeys:
                    - keyData: ssh-rsa 0
                      path: /home/user/.ssh/authorized_keys0
                    - keyData: ssh-rsa 1
                      path: /home/user/.ssh/authorized_keys1
                  publisher: RDFE-Test-Microsoft-Windows-Server-Group
                  resourceGroupName: macikgo-test-may-23
                  sku: Windows-Server-2012-R2-Datacenter
                  subscriptionId: 8d10da13-8125-4ba9-a717-bf7490507b3d
                  tags: baz:bash;foo:bar
                  version: 15.05.22
                  vmId: 02aab8a4-74ef-476e-8182-f6d2ba4166a6
                  vmScaleSetName: crpteste9vflji9
                  vmSize: Standard_A3
                  zone: ""
            "400":
              body:
                error: Bad request
            "403":
              body:
                error: Forbidden
            "404":
              body:
                error: Not found
            "405":
              body:
                error: Not allowed
            "429":
              body:
                error: Too many requests
            "500":
              body:
                error: Server error
            "503":
              body:
                error: Service unavailable
definitions:
  AttestedData:
    description: This is the response from the Attested_GetDocument operation.
    properties:
      encoding:
        description: This is the encoding scheme of the signature.
        type: string
      signature:
        description: This is the encoded string containing the VM ID, plan information, public key, timestamp, and nonce value.
        type: string
    type: object
  Compute:
    description: Compute Metadata
    properties:
      azEnvironment:
        description: This is the name of the environment in which the VM is running.
        type: string
      location:
        description: This is the Azure Region in which the VM is running.
        type: string
      name:
        description: This is the name of the VM.
        type: string
      offer:
        description: This is the offer information for the VM image. This value is only present for images deployed from the Azure Image Gallery.
        type: string
      osType:
        description: This value indicates the type of OS the VM is running, either Linux or Windows.
        type: string
      placementGroupId:
        description: This is the placement group of your Virtual Machine Scale Set.
        type: string
      plan:
        $ref: "#/definitions/PlanProperties"
        description: This contains the data about the plan.
        type: object
      platformFaultDomain:
        description: This is the fault domain in which the VM.
        type: string
      platformUpdateDomain:
        description: This is the update domain in which the VM.
        type: string
      provider:
        description: This is the provider of the VM.
        type: string
      publicKeys:
        description: This is information about the SSH certificate
        items:
          $ref: "#/definitions/PublicKeysProperties"
        type: array
      publisher:
        description: This is the publisher of the VM image.
        type: string
      resourceGroupName:
        description: This is the resource group for the VM.
        type: string
      sku:
        description: This is the specific SKU for the VM image.
        type: string
      subscriptionId:
        description: This is the Azure subscription for the VM.
        type: string
      tags:
        description: This is the list of tags for your VM.
        type: string
      version:
        description: This is the version of the VM image.
        type: string
      vmId:
        description: This is the unique identifier for the VM.
        type: string
      vmScaleSetName:
        description: This is the resource name of the VMSS.
        type: string
      vmSize:
        description: This is the size of the VM.
        type: string
      zone:
        description: This is the availability zone of the VM.
        type: string
    type: object
  ErrorResponse:
    description: This is the response from an operation in the case an error occurs.
    properties:
      error:
        description: Error message indicating why the operation failed.
        type: string
    type: object
  IdentityErrorResponse:
    description: This is the response from an Identity operation in the case an error occurs.
    properties:
      error:
        description: Error code
        enum:
          - invalid_request
          - unauthorized_client
          - access_denied
          - unsupported_response_type
          - invalid_scope
          - server_error
          - service_unavailable
          - bad_request
          - forbidden
          - not_found
          - method_not_allowed
          - too_many_requests
        type: string
        x-ms-enum:
          modelAsString: true
          name: Error
      error_description:
        description: Error message indicating why the operation failed.
        type: string
    type: object
  IdentityInfoResponse:
    description: This is the response from the Identity_GetInfo operation.
    properties:
      tenantId:
        description: This is the AAD tenantId of the identity of the caller.
        type: string
    type: object
  IdentityTokenResponse:
    description: This is the response from the Identity_GetToken operation.
    properties:
      access_token:
        description: This is the requested access token. The app can use this token to authenticate to the sink resource.
        type: string
      client_id:
        description: This is the client_id specified in the request, if any.
        type: string
      expires_in:
        description: This is how long the access token is valid (in seconds).
        type: string
      expires_on:
        description: This is the time when the access token expires. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time. This value is used to determine the lifetime of cached tokens.
        type: string
      ext_expires_in:
        description: This indicates the extended lifetime of the token.
        type: string
      msi_res_id:
        description: This is the msi_res_id specified in the request, if any.
        type: string
      not_before:
        description: This is the time when the access token becomes effective. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time.
        type: string
      object_id:
        description: This is the object_id specified in the request, if any.
        type: string
      resource:
        description: This is the app ID URI of the sink resource.
        type: string
      token_type:
        description: This indicates the token type value.
        type: string
    type: object
  Instance:
    description: This is the response from the Instance_GetMetadata operation.
    properties:
      compute:
        $ref: "#/definitions/Compute"
        description: Compute Metadata
      network:
        $ref: "#/definitions/Network"
        description: Network Metadata
    type: object
  Ipv4Properties:
    description: This contains the IPv4 properties.
    properties:
      privateIpAddress:
        description: This is the private IP address assigned to the interface.
        type: string
      publicIpAddress:
        description: This is the public IP address assigned to the interface.
        type: string
    type: object
  Ipv6Properties:
    description: This contains the IPv6 properties.
    properties:
      privateIpAddress:
        description: This is the private IPv6 address assigned to the interface.
        type: string
    type: object
  Network:
    description: Network Metadata
    properties:
      interface:
        description: This contains data about the network interface.
        items:
          $ref: "#/definitions/NetworkInterface"
          type: object
        type: array
    type: object
  NetworkInterface:
    description: This contains data about the network interface.
    properties:
      ipv4:
        description: This contains the IPv4 address.
        properties:
          ipAddress:
            description: This is the IP address
            items:
              $ref: "#/definitions/Ipv4Properties"
              description: This contains the IPv4 properties.
              type: object
            type: array
          subnet:
            description: This is the subnet
            items:
              $ref: "#/definitions/SubnetProperties"
              description: This contains the subnet properties.
              type: object
            type: array
        type: object
      ipv6:
        description: This contains the IPv6 address.
        properties:
          ipAddress:
            description: This is the IP address
            items:
              $ref: "#/definitions/Ipv6Properties"
              description: This contains the IPv6 properties.
              type: object
            type: array
        type: object
      macAddress:
        description: This is the MAC address of the interface.
        type: string
    type: object
  PlanProperties:
    description: This contains the data about the plan.
    properties:
      name:
        description: This is the Plan ID.
        type: string
      product:
        description: This is the product of the image from the Marketplace.
        type: string
      publisher:
        description: This is the publisher ID.
        type: string
    type: object
  PublicKeysProperties:
    description: This contains the data about the public key.
    properties:
      keyData:
        description: This is the SSH public key certificate used to authenticate with the VM.
        type: string
      path:
        description: This specifies the full path on the VM where the SSH public key is stored.
        type: string
    type: object
  SubnetProperties:
    description: This contains the properties of the subnet.
    properties:
      address:
        description: This is the address range of the subnet.
        type: string
      prefix:
        description: This is the prefix of the subnet.
        type: string
    type: object
