Servers - Create

Creates a new server or updates an existing server. The update action will overwrite the existing server.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}?api-version=2017-12-01

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The subscription ID that identifies an Azure subscription.

resourceGroupName
path True
  • string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

serverName
path True
  • string

The name of the server.

api-version
query True
  • string

The API version to use for the request.

Request Body

Name Required Type Description
location True
  • string

The location the resource resides in.

properties True ServerPropertiesForCreate:

Properties of the server.

sku

The SKU (pricing tier) of the server.

tags
  • object

Application-specific metadata in the form of key-value pairs.

Responses

Name Type Description
200 OK

OK

201 Created

Created

202 Accepted

Accepted

Examples

Create a database as a point in time restore
Create a new server
Create a server as a geo restore

Create a database as a point in time restore

Sample Request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver?api-version=2017-12-01
{
  "location": "brazilsouth",
  "properties": {
    "restorePointInTime": "2017-12-14T00:00:37.467Z",
    "createMode": "PointInTimeRestore",
    "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver"
  },
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "tags": {
    "ElasticServer": "1"
  }
}

Sample Response

{
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "properties": {
    "administratorLogin": "cloudsa",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 7,
      "geoRedundantBackup": "Enabled"
    },
    "version": "5.7",
    "sslEnforcement": "Enabled",
    "userVisibleState": "Ready",
    "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com",
    "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
  },
  "location": "brazilsouth",
  "tags": {
    "ElasticServer": "1"
  },
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/targetserver",
  "name": "targetserver",
  "type": "Microsoft.DBforMySQL/servers"
}
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/targetserver",
  "name": "targetserver",
  "type": "Microsoft.DBforMySQL/servers",
  "location": "brazilsouth",
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "tags": {
    "elasticServer": "1"
  },
  "properties": {
    "administratorLogin": "cloudsa",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 7,
      "geoRedundantBackup": "Enabled"
    },
    "version": "5.7",
    "sslEnforcement": "Enabled",
    "userVisibleState": "Ready",
    "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com",
    "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
  }
}

Create a new server

Sample Request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4?api-version=2017-12-01
{
  "location": "westus",
  "properties": {
    "administratorLogin": "cloudsa",
    "administratorLoginPassword": "pass$w0rd",
    "sslEnforcement": "Enabled",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 7,
      "geoRedundantBackup": "Enabled"
    },
    "createMode": "Default"
  },
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "capacity": 2,
    "family": "Gen4"
  },
  "tags": {
    "ElasticServer": "1"
  }
}

Sample Response

{
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "properties": {
    "administratorLogin": "cloudsa",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 7,
      "geoRedundantBackup": "Enabled"
    },
    "version": "5.7",
    "sslEnforcement": "Enabled",
    "userVisibleState": "Ready",
    "fullyQualifiedDomainName": "mysqltestsvc4.mysql.database.azure.com",
    "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
  },
  "location": "westus",
  "tags": {
    "ElasticServer": "1"
  },
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4",
  "name": "mysqltestsvc4",
  "type": "Microsoft.DBforMySQL/servers"
}
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4",
  "name": "mysqltestsvc4",
  "type": "Microsoft.DBforMySQL/servers",
  "location": "westus",
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "tags": {
    "elasticServer": "1"
  },
  "properties": {
    "administratorLogin": "cloudsa",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 7,
      "geoRedundantBackup": "Enabled"
    },
    "version": "5.7",
    "sslEnforcement": "Enabled",
    "userVisibleState": "Ready",
    "fullyQualifiedDomainName": "mysqltestsvc4.mysql.database.azure.com",
    "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
  }
}

Create a server as a geo restore

Sample Request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver?api-version=2017-12-01
{
  "location": "westus",
  "properties": {
    "createMode": "GeoRestore",
    "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver"
  },
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "tags": {
    "ElasticServer": "1"
  }
}

Sample Response

{
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "properties": {
    "administratorLogin": "cloudsa",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 14,
      "geoRedundantBackup": "Enabled"
    },
    "version": "5.7",
    "sslEnforcement": "Enabled",
    "userVisibleState": "Ready",
    "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com",
    "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
  },
  "location": "westus",
  "tags": {
    "ElasticServer": "1"
  },
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/targetserver",
  "name": "targetserver",
  "type": "Microsoft.DBforMySQL/servers"
}
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/targetserver",
  "name": "targetserver",
  "type": "Microsoft.DBforMySQL/servers",
  "location": "westus",
  "sku": {
    "name": "GP_Gen4_2",
    "tier": "GeneralPurpose",
    "family": "Gen4",
    "capacity": 2
  },
  "tags": {
    "elasticServer": "1"
  },
  "properties": {
    "administratorLogin": "cloudsa",
    "storageProfile": {
      "storageMB": 128000,
      "backupRetentionDays": 14,
      "geoRedundantBackup": "Enabled"
    },
    "version": "5.7",
    "sslEnforcement": "Enabled",
    "userVisibleState": "Ready",
    "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com",
    "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
  }
}

Definitions

GeoRedundantBackup

Enable Geo-redundant or not for server backup.

Server

Represents a server.

ServerForCreate

Represents a server to be created.

ServerPropertiesForDefaultCreate

The properties used to create a new server.

ServerPropertiesForGeoRestore

The properties used to create a new server by restoring to a different region from a geo replicated backup.

ServerPropertiesForRestore

The properties used to create a new server by restoring from a backup.

ServerState

A state of a server that is visible to user.

ServerVersion

The version of a server.

Sku

Billing information related properties of a server.

SkuTier

The tier of the particular SKU, e.g. Basic.

SslEnforcementEnum

Enable ssl enforcement or not when connect to server.

StorageProfile

Storage Profile properties of a server

GeoRedundantBackup

Enable Geo-redundant or not for server backup.

Name Type Description
Disabled
  • string
Enabled
  • string

Server

Represents a server.

Name Type Description
id
  • string

Resource ID

location
  • string

The location the resource resides in.

name
  • string

Resource name.

properties.administratorLogin
  • string

The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).

properties.earliestRestoreDate
  • string

Earliest restore point creation time (ISO8601 format)

properties.fullyQualifiedDomainName
  • string

The fully qualified domain name of a server.

properties.sslEnforcement

Enable ssl enforcement or not when connect to server.

properties.storageProfile

Storage profile of a server.

properties.userVisibleState

A state of a server that is visible to user.

properties.version

Server version.

sku

The SKU (pricing tier) of the server.

tags
  • object

Application-specific metadata in the form of key-value pairs.

type
  • string

Resource type.

ServerForCreate

Represents a server to be created.

Name Type Description
location
  • string

The location the resource resides in.

properties ServerPropertiesForCreate:

Properties of the server.

sku

The SKU (pricing tier) of the server.

tags
  • object

Application-specific metadata in the form of key-value pairs.

ServerPropertiesForDefaultCreate

The properties used to create a new server.

Name Type Description
administratorLogin
  • string

The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).

administratorLoginPassword
  • string

The password of the administrator login.

createMode string:
  • Default

The mode to create a new server.

sslEnforcement

Enable ssl enforcement or not when connect to server.

storageProfile

Storage profile of a server.

version

Server version.

ServerPropertiesForGeoRestore

The properties used to create a new server by restoring to a different region from a geo replicated backup.

Name Type Description
createMode string:
  • GeoRestore

The mode to create a new server.

sourceServerId
  • string

The source server id to restore from.

sslEnforcement

Enable ssl enforcement or not when connect to server.

storageProfile

Storage profile of a server.

version

Server version.

ServerPropertiesForRestore

The properties used to create a new server by restoring from a backup.

Name Type Description
createMode string:
  • PointInTimeRestore

The mode to create a new server.

restorePointInTime
  • string

Restore point creation time (ISO8601 format), specifying the time to restore from.

sourceServerId
  • string

The source server id to restore from.

sslEnforcement

Enable ssl enforcement or not when connect to server.

storageProfile

Storage profile of a server.

version

Server version.

ServerState

A state of a server that is visible to user.

Name Type Description
Disabled
  • string
Dropping
  • string
Ready
  • string

ServerVersion

The version of a server.

Name Type Description
5.6
  • string
5.7
  • string

Sku

Billing information related properties of a server.

Name Type Description
capacity
  • integer

The scale up/out capacity, representing server's compute units.

family
  • string

The family of hardware.

name
  • string

The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.

size
  • string

The size code, to be interpreted by resource as appropriate.

tier

The tier of the particular SKU, e.g. Basic.

SkuTier

The tier of the particular SKU, e.g. Basic.

Name Type Description
Basic
  • string
GeneralPurpose
  • string
MemoryOptimized
  • string

SslEnforcementEnum

Enable ssl enforcement or not when connect to server.

Name Type Description
Disabled
  • string
Enabled
  • string

StorageProfile

Storage Profile properties of a server

Name Type Description
backupRetentionDays
  • integer

Backup retention days for the server.

geoRedundantBackup

Enable Geo-redundant or not for server backup.

storageMB
  • integer

Max storage allowed for a server.