az mysql flexible-server
Note
This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.
Manage Azure Database for MySQL Flexible Servers.
Commands
Name | Description | Type | Status |
---|---|---|---|
az mysql flexible-server ad-admin |
Manage server Active Directory administrator. |
Core | GA |
az mysql flexible-server ad-admin create |
Create an Active Directory administrator. |
Core | GA |
az mysql flexible-server ad-admin delete |
Delete an Active Directory administrator. |
Core | GA |
az mysql flexible-server ad-admin list |
List all Active Directory administrators. |
Core | GA |
az mysql flexible-server ad-admin show |
Get an Active Directory administrator. |
Core | GA |
az mysql flexible-server ad-admin wait |
Wait for the Active Directory administrator to satisfy certain conditions. |
Core | GA |
az mysql flexible-server advanced-threat-protection-setting |
Manage the server's advanced threat protection setting. |
Core | GA |
az mysql flexible-server advanced-threat-protection-setting show |
Get the server's advanced threat protection setting. |
Core | GA |
az mysql flexible-server advanced-threat-protection-setting update |
Update the server's advanced threat protection setting. |
Core | GA |
az mysql flexible-server backup |
Manage flexible server backups. |
Core | GA |
az mysql flexible-server backup create |
Create a backup for a given server with specified backup name. |
Core | GA |
az mysql flexible-server backup list |
List all the backups for a given server. |
Core | GA |
az mysql flexible-server backup show |
Show the details of a specific backup for a given server. |
Core | GA |
az mysql flexible-server connect |
Connect to a flexible server. |
Extension | GA |
az mysql flexible-server create |
Create a MySQL flexible server. |
Core | GA |
az mysql flexible-server db |
Manage MySQL databases on a flexible server. |
Core | GA |
az mysql flexible-server db create |
Create a MySQL database on a flexible server. |
Core | GA |
az mysql flexible-server db delete |
Delete a database on a flexible server. |
Core | GA |
az mysql flexible-server db list |
List the databases for a flexible server. |
Core | GA |
az mysql flexible-server db show |
Show the details of a database. |
Core | GA |
az mysql flexible-server delete |
Delete a flexible server. |
Core | GA |
az mysql flexible-server deploy |
Enable and run GitHub Actions workflow for MySQL server. |
Core | GA |
az mysql flexible-server deploy run |
Run an existing workflow in your github repository. |
Core | GA |
az mysql flexible-server deploy setup |
Create GitHub Actions workflow file for MySQL server. |
Core | GA |
az mysql flexible-server detach-vnet |
Detach vnet for a flexible server. |
Core | GA |
az mysql flexible-server execute |
Connect to a flexible server. |
Extension | GA |
az mysql flexible-server export |
Manage export backup on a server. |
Core | Preview |
az mysql flexible-server export create |
Create an export backup for a given server with specified backup name. |
Core | Preview |
az mysql flexible-server firewall-rule |
Manage firewall rules for a server. |
Core | GA |
az mysql flexible-server firewall-rule create |
Create a new firewall rule for a flexible server. |
Core | GA |
az mysql flexible-server firewall-rule delete |
Delete a firewall rule. |
Core | GA |
az mysql flexible-server firewall-rule list |
List all firewall rules for a flexible server. |
Core | GA |
az mysql flexible-server firewall-rule show |
Get the details of a firewall rule. |
Core | GA |
az mysql flexible-server firewall-rule update |
Update a firewall rule. |
Core | GA |
az mysql flexible-server geo-restore |
Geo-restore a flexible server from backup. |
Core | GA |
az mysql flexible-server gtid |
Manage GTID on a server. |
Core | GA |
az mysql flexible-server gtid reset |
Resets GTID on a server. |
Core | GA |
az mysql flexible-server identity |
Manage server user assigned identities. |
Core | GA |
az mysql flexible-server identity assign |
Add user asigned managed identities to the server. |
Core | GA |
az mysql flexible-server identity list |
List all user assigned managed identities from the server. |
Core | GA |
az mysql flexible-server identity remove |
Remove user asigned managed identites from the server. |
Core | GA |
az mysql flexible-server identity show |
Get an user assigned managed identity from the server. |
Core | GA |
az mysql flexible-server import |
Manage import workflows for MySQL Flexible Servers. |
Core | GA |
az mysql flexible-server import create |
Create a new import workflow for flexible server. |
Core | GA |
az mysql flexible-server import stop-replication |
To stop replication between the source single server and target flexible server. |
Core | GA |
az mysql flexible-server list |
List available flexible servers. |
Core | GA |
az mysql flexible-server list-skus |
Lists available sku's in the given region. |
Core | GA |
az mysql flexible-server maintenance |
Manage maintenance on a flexible server. |
Core | GA |
az mysql flexible-server maintenance list |
List all of the maintenances of a flexible server. |
Core | GA |
az mysql flexible-server maintenance reschedule |
Reschedule the ongoing planned maintenance of a flexible server. |
Core | GA |
az mysql flexible-server maintenance show |
Get the specific maintenance of a flexible server by maintenance name. |
Core | GA |
az mysql flexible-server parameter |
Commands for managing server parameter values for flexible server. |
Core | GA |
az mysql flexible-server parameter list |
List the parameter values for a flexible server. |
Core | GA |
az mysql flexible-server parameter set |
Update the parameter of a flexible server. |
Core | GA |
az mysql flexible-server parameter set-batch |
Batch update parameters of a flexible server. |
Core | GA |
az mysql flexible-server parameter show |
Get the parameter for a flexible server.". |
Core | GA |
az mysql flexible-server replica |
Manage read replicas. |
Core | GA |
az mysql flexible-server replica create |
Create a read replica for a server. |
Core | GA |
az mysql flexible-server replica list |
List all read replicas for a given server. |
Core | GA |
az mysql flexible-server replica stop-replication |
Stop replication to a read replica and make it a read/write server. |
Core | GA |
az mysql flexible-server restart |
Restart a flexible server. |
Core | GA |
az mysql flexible-server restore |
Restore a flexible server from backup. |
Core | GA |
az mysql flexible-server server-logs |
Manage server logs. |
Core | GA |
az mysql flexible-server server-logs download |
Download log files. |
Core | GA |
az mysql flexible-server server-logs list |
List log files for a server. |
Core | GA |
az mysql flexible-server show |
Get the details of a flexible server. |
Core | GA |
az mysql flexible-server show-connection-string |
Show the connection strings for a MySQL flexible-server database. |
Core | GA |
az mysql flexible-server start |
Start a flexible server. |
Core | GA |
az mysql flexible-server stop |
Stop a flexible server. |
Core | GA |
az mysql flexible-server update |
Update a flexible server. |
Core | GA |
az mysql flexible-server upgrade |
Upgrade the major version of a flexible server. |
Core | GA |
az mysql flexible-server wait |
Wait for the flexible server to satisfy certain conditions. |
Core | GA |
az mysql flexible-server connect
Connect to a flexible server.
az mysql flexible-server connect --admin-user
--name
[--admin-password]
[--database-name]
[--interactive]
[--querytext]
Required Parameters
The login username of the administrator.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Optional Parameters
The login password of the administrator.
The name of a database.
Pass this parameter to connect to database in interactive mode.
Argument 'querytext' has been deprecated and will be removed in a future release. Use 'execute' instead.
A query to run against the flexible server.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server create
Create a MySQL flexible server.
Create a MySQL flexible server with custom or default configuration. For more information for network configuration, see
- Configure public access https://docs.microsoft.com/en-us/azure/mysql/flexible-server/how-to-manage-firewall-cli
- Configure private access https://docs.microsoft.com/en-us/azure/mysql/flexible-server/how-to-manage-virtual-network-cli.
az mysql flexible-server create [--accelerated-logs {Disabled, Enabled}]
[--address-prefixes]
[--admin-password]
[--admin-user]
[--auto-scale-iops {Disabled, Enabled}]
[--backup-identity]
[--backup-key]
[--backup-retention]
[--database-name]
[--geo-redundant-backup {Disabled, Enabled}]
[--high-availability {Disabled, SameZone, ZoneRedundant}]
[--identity]
[--iops]
[--key]
[--location]
[--name]
[--private-dns-zone]
[--public-access]
[--resource-group]
[--sku-name]
[--standby-zone]
[--storage-auto-grow {Disabled, Enabled}]
[--storage-size]
[--subnet]
[--subnet-prefixes]
[--tags]
[--tier]
[--version]
[--vnet]
[--yes]
[--zone]
Examples
Create a MySQL flexible server with custom parameters
az mysql flexible-server create --location northeurope --resource-group testGroup \
--name testserver --admin-user username --admin-password password \
--sku-name Standard_B1ms --tier Burstable --public-access 0.0.0.0 --storage-size 32 \
--tags "key=value" --version 5.7 --high-availability ZoneRedundant --zone 1 \
--standby-zone 3 --storage-auto-grow Enabled --iops 500
Create a MySQL flexible server with default parameters and public access enabled by default. Resource group, server name, username, password, and default database will be created by CLI
az mysql flexible-server create
Create a MySQL flexible server with public access and add the range of IP address to have access to this server. The --public-access parameter can be 'All', 'None', <startIpAddress>, or <startIpAddress>-<endIpAddress>
az mysql flexible-server create --resource-group testGroup --name testserver --public-access 125.23.54.31-125.23.54.35
Create a MySQL flexible server with private access. If provided virtual network and subnet do not exists, virtual network and subnet with the specified address prefixes will be created.
az mysql flexible-server create --resource-group testGroup --name testserver --vnet myVnet --subnet mySubnet --address-prefixes 10.0.0.0/16 --subnet-prefixes 10.0.0.0/24
Create a MySQL flexible server using a new subnet resource ID and new private DNS zone resource ID. The subnet and DNS zone can be created in different subscription or resource group.
az mysql flexible-server create \
--resource-group testGroup --name testserver \
--subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNetName}/subnets/{SubnetName} \
--private-dns-zone /subscriptions/{SubID}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/privateDnsZones/testMySQLFlexibleDnsZone.private.mysql.database.azure.com \
--address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24
Create a MySQL flexible server using existing network resources in the same resource group. The provided subnet should not have any other resource deployed in it and this subnet will be delegated to Microsoft.DBforMySQL/flexibleServers, if not already delegated. The private DNS zone will be linked to the virtual network if not already linked.
# create vnet
az network vnet create --resource-group testGroup --name testVnet --location testLocation --address-prefixes 172.0.0.0/16
# create subnet
az network vnet subnet create --resource-group testGroup --vnet-name testVnet --address-prefixes 172.0.0.0/24 --name testSubnet
# create private dns zone
az network private-dns zone create -g testGroup -n testDNS.private.mysql.database.azure.com
az mysql flexible-server create --resource-group testGroup \
--name testserver --location testLocation \
--subnet /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
--private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.mysql.database.azure.com\
az mysql flexible-server create --resource-group testGroup --name testserver \
--vnet testVnet --subnet testSubnet --location testLocation \
--private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.mysql.database.azure.com
Create a MySQL flexible server using existing network resources in the different resource group / subscription.
az mysql flexible-server create --resource-group testGroup \
--name testserver --location testLocation \
--subnet /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
--private-dns-zone /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/privateDnsZones/testDNS.mysql.database.azure.com
Create a MySQL flexible server with data encryption.
# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
--enable-purge-protection true
# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
--vault-name testVault --query key.kid -o tsv)
# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
--location testLocation --query principalId -o tsv)
# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
--key-permissions wrapKey unwrapKey get list
# create flexible server with data encryption enabled
az mysql flexible-server create -g testGroup -n testServer --location testLocation \
--key $keyIdentifier --identity testIdentity
Create a MySQL flexible server with geo redundant backup and data encryption.
# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
--enable-purge-protection true
# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
--vault-name testVault --query key.kid -o tsv)
# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
--location testLocation --query principalId -o tsv)
# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
--key-permissions wrapKey unwrapKey get list
# create backup keyvault
az keyvault create -g testGroup -n testBackupVault --location testBackupLocation \
--enable-purge-protection true
# create backup key in backup keyvault and save its key identifier
backupKeyIdentifier=$(az keyvault key create --name testBackupKey -p software \
--vault-name testBackupVault --query key.kid -o tsv)
# create backup identity and save its principalId
backupIdentityPrincipalId=$(az identity create -g testGroup --name testBackupIdentity \
--location testBackupLocation --query principalId -o tsv)
# add testBackupIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testBackupVault
az keyvault set-policy -g testGroup -n testBackupVault \
--object-id $backupIdentityPrincipalId --key-permissions wrapKey unwrapKey get list
# create flexible server with geo redundant backup and data encryption enabled
az mysql flexible-server create -g testGroup -n testServer --location testLocation \
--geo-redundant-backup Enabled \
--key $keyIdentifier --identity testIdentity \
--backup-key $backupKeyIdentifier --backup-identity testBackupIdentity
Optional Parameters
Enable or disable accelerated logs. Only support for Business Critical tier. Default value is Enabled.
The IP address prefix to use when creating a new virtual network in CIDR format. Default value is 10.0.0.0/16.
The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.
Administrator username for the server. Once set, it cannot be changed.
Enable or disable the auto scale iops. Default value is Disabled.
The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.
The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.
The number of days a backup is retained. Range of 1 to 35 days. Default is 7 days.
The name of the database to be created when provisioning the database server.
Whether or not geo redundant backup is enabled.
Enable (ZoneRedundant or SameZone) or disable high availability feature.
The name or resource ID of the user assigned identity for data encryption.
Number of IOPS to be allocated for this server. You will get certain amount of free IOPS based on compute and storage provisioned. The default value for IOPS is free IOPS. To learn more about IOPS based on compute and storage, refer to IOPS in Azure Database for MySQL Flexible Server.
The resource ID of the primary keyvault key for data encryption.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.
Determines the public access. Enter single or range of IP addresses to be included in the allowed list of IPs. IP address ranges must be dash-separated and not contain any spaces. Specifying 0.0.0.0 allows public access from any resources deployed within Azure to access your server. Setting it to "None" sets the server in public access mode but does not create a firewall rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms.
The availability zone information of the standby server when high availability is enabled.
Enable or disable autogrow of the storage. Default value is Enabled.
The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.
Name or resource ID of a new or existing subnet. This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to flexibleServers. After delegation, this subnet cannot be used for any other type of Azure resources.
The subnet IP address prefix to use when creating a new subnet in CIDR format. Default value is 10.0.0.0/24.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Compute tier of the server. Accepted values: Burstable, GeneralPurpose, MemoryOptimized.
Server major version.
Name or ID of a new or existing virtual network. This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. If you want to use a vnet from different resource group or subscription, please provide a resource ID. The name must be between 2 to 64 characters. The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.
Do not prompt for confirmation.
Availability zone into which to provision the resource.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server delete
Delete a flexible server.
az mysql flexible-server delete [--ids]
[--name]
[--resource-group]
[--subscription]
[--yes]
Examples
Delete a flexible server.
az mysql flexible-server delete --resource-group testGroup --name testserver
Delete a flexible server without confirmation prompt.
az mysql flexible-server delete --resource-group testGroup --name testserver --yes
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server detach-vnet
Detach vnet for a flexible server.
az mysql flexible-server detach-vnet --public-network-access {Disabled, Enabled}
[--ids]
[--name]
[--resource-group]
[--subscription]
[--yes]
Examples
Detach vnet for a flexible server with public access disabled.
az mysql flexible-server detach-vnet --resource-group testGroup --name testserver --public-network-access Disabled
Required Parameters
Determines the public access after vnet detach.
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server execute
Connect to a flexible server.
az mysql flexible-server execute --admin-password
--admin-user
--name
[--database-name]
[--file-path]
[--querytext]
Required Parameters
The login password of the administrator.
The login username of the administrator.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Optional Parameters
The name of a database.
The path of the sql file to execute.
A query to run against the flexible server.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server geo-restore
Geo-restore a flexible server from backup.
az mysql flexible-server geo-restore --location
--source-server
[--accelerated-logs {Disabled, Enabled}]
[--address-prefixes]
[--backup-retention]
[--geo-redundant-backup {Disabled, Enabled}]
[--ids]
[--name]
[--no-wait]
[--private-dns-zone]
[--public-access {Disabled, Enabled}]
[--resource-group]
[--sku-name]
[--storage-auto-grow {Disabled, Enabled}]
[--storage-size]
[--subnet]
[--subnet-prefixes]
[--subscription]
[--tags]
[--tier]
[--vnet]
[--yes]
[--zone]
Examples
Geo-restore 'testserver' to a new server 'testserverNew' in location 'newLocation' with the same network configuration. Private access server will use different private dns zone.
az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --location newLocation
Geo-restore public access or private access server 'testserver' as a new server 'testserverNew' with new subnet. New vnet, subnet, and private dns zone for the restored server will be provisioned. Please refer to 'flexible-server create' command for more private access scenarios.
az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew \
--source-server testserver --vnet newVnet --subnet newSubnet \
--address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
--private-dns-zone testDNS.mysql.database.azure.com --location newLocation
Geo-restore private access server 'testserver' as a new server 'testserverNew' with public access.
az mysql flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --public-access Enabled --location newLocation
Required Parameters
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
The name or resource ID of the source server to restore from.
Optional Parameters
Enable or disable accelerated logs. Only support for Business Critical tier. Default value is Enabled.
The IP address prefix to use when creating a new virtual network in CIDR format. Default value is 10.0.0.0/16.
The number of days a backup is retained. Range of 1 to 35 days. Default is 7 days.
Whether or not geo redundant backup is enabled.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Do not wait for the long-running operation to finish.
This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.
Determines the public access.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms.
Enable or disable autogrow of the storage. Default value is Enabled.
The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.
Name or resource ID of a new or existing subnet. This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to flexibleServers. After delegation, this subnet cannot be used for any other type of Azure resources.
The subnet IP address prefix to use when creating a new subnet in CIDR format. Default value is 10.0.0.0/24.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Compute tier of the server. Accepted values: Burstable, GeneralPurpose, MemoryOptimized.
Name or ID of a new or existing virtual network. This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. If you want to use a vnet from different resource group or subscription, please provide a resource ID. The name must be between 2 to 64 characters. The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.
Do not prompt for confirmation.
Availability zone into which to provision the resource.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server list
List available flexible servers.
az mysql flexible-server list [--resource-group]
Examples
List all MySQL flexible servers in a subscription.
az mysql flexible-server list
List all MySQL flexible servers in a resource group.
az mysql flexible-server list --resource-group testGroup
List all MySQL flexible servers in a resource group in table format.
az mysql flexible-server list --resource-group testGroup --output table
Optional Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server list-skus
Lists available sku's in the given region.
az mysql flexible-server list-skus --location
Examples
Lists available sku's in the given region.
az mysql flexible-server list-skus -l eastus
Lists available sku's in the given region in table output
az mysql flexible-server list-skus -l eastus -o table
Required Parameters
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server restart
Restart a flexible server.
az mysql flexible-server restart [--failover]
[--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Restart a flexible server.
az mysql flexible-server restart --resource-group testGroup --name testserver
Restart a flexible server with failover
az mysql flexible-server restart --resource-group testGroup --name testserver --failover Forced
Optional Parameters
Forced failover for server restart operation. Allowed values: Forced.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server restore
Restore a flexible server from backup.
az mysql flexible-server restore --source-server
[--accelerated-logs {Disabled, Enabled}]
[--address-prefixes]
[--backup-retention]
[--geo-redundant-backup {Disabled, Enabled}]
[--ids]
[--name]
[--no-wait]
[--private-dns-zone]
[--public-access {Disabled, Enabled}]
[--resource-group]
[--restore-time]
[--sku-name]
[--storage-auto-grow {Disabled, Enabled}]
[--storage-size]
[--subnet]
[--subnet-prefixes]
[--subscription]
[--tags]
[--tier]
[--vnet]
[--yes]
[--zone]
Examples
Restore 'testserver' to a specific point-in-time as a new server 'testserverNew' with the same network configuration.
az mysql flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver --restore-time "2017-06-15T13:10:00Z"
Restore public access or private access server 'testserver' as a new server 'testserverNew' with new subnet to current point-in-time. New vnet, subnet, and private dns zone for the restored server will be provisioned. Please refer to 'flexible-server create' command for more private access scenarios.
az mysql flexible-server restore --resource-group testGroup --name testserverNew \
--source-server testserver --vnet newVnet --subnet newSubnet \
--address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
--private-dns-zone testDNS.mysql.database.azure.com
Restore private access server 'testserver' to current point-in-time as a new server 'testserverNew' with public access.
az mysql flexible-server restore --resource-group testGroup --name testserverNew \
--source-server testserver --public-access Enabled
Required Parameters
The name or resource ID of the source server to restore from.
Optional Parameters
Enable or disable accelerated logs. Only support for Business Critical tier. Default value is Enabled.
The IP address prefix to use when creating a new virtual network in CIDR format. Default value is 10.0.0.0/16.
The number of days a backup is retained. Range of 1 to 35 days. Default is 7 days.
Whether or not geo redundant backup is enabled.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Do not wait for the long-running operation to finish.
This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.
Determines the public access.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The point in time in UTC to restore from (ISO8601 format), e.g., 2017-04-26T02:10:00+00:00The default value is set to current time.
The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms.
Enable or disable autogrow of the storage. Default value is Enabled.
The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.
Name or resource ID of a new or existing subnet. This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to flexibleServers. After delegation, this subnet cannot be used for any other type of Azure resources.
The subnet IP address prefix to use when creating a new subnet in CIDR format. Default value is 10.0.0.0/24.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Compute tier of the server. Accepted values: Burstable, GeneralPurpose, MemoryOptimized.
Name or ID of a new or existing virtual network. This parameter only applies if you are creating cross region replica server with private access. For in-region read replica with private access, source server settings are carried over and this parameter is ignored. If you want to use a vnet from different resource group or subscription, please provide a resource ID. The name must be between 2 to 64 characters. The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.
Do not prompt for confirmation.
Availability zone into which to provision the resource.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server show
Get the details of a flexible server.
az mysql flexible-server show [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Get the details of a flexible server
az mysql flexible-server show --resource-group testGroup --name testserver
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server show-connection-string
Show the connection strings for a MySQL flexible-server database.
az mysql flexible-server show-connection-string [--admin-password]
[--admin-user]
[--database-name]
[--ids]
[--server-name]
[--subscription]
Examples
Show connection strings for cmd and programming languages.
az mysql flexible-server show-connection-string -s testserver -u username -p password -d databasename
Optional Parameters
The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.
Administrator username for the server. Once set, it cannot be changed.
The name of the database to be created when provisioning the database server.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server start
Start a flexible server.
az mysql flexible-server start [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Start a flexible server.
az mysql flexible-server start --resource-group testGroup --name testserver
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server stop
Stop a flexible server.
az mysql flexible-server stop [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Stop a flexible server.
az mysql flexible-server stop --resource-group testGroup --name testserver
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server update
Update a flexible server.
[!WARNING] > Enabling High-availability may result in a short downtime for the server based on your server configuration.
az mysql flexible-server update [--accelerated-logs {Disabled, Enabled}]
[--add]
[--admin-password]
[--auto-scale-iops {Disabled, Enabled}]
[--backup-identity]
[--backup-key]
[--backup-retention]
[--disable-data-encryption {false, true}]
[--force-string]
[--geo-redundant-backup {Disabled, Enabled}]
[--high-availability {Disabled, SameZone, ZoneRedundant}]
[--identity]
[--ids]
[--iops]
[--key]
[--maintenance-window]
[--name]
[--public-access {Disabled, Enabled}]
[--remove]
[--replication-role]
[--resource-group]
[--set]
[--sku-name]
[--standby-zone]
[--storage-auto-grow {Disabled, Enabled}]
[--storage-size]
[--subscription]
[--tags]
[--tier]
Examples
Update a flexible server's sku, using local context for server and resource group.
az mysql flexible-server update --sku-name Standard_D4ds_v4 --tier GeneralPurpose
Update a flexible server's tags.
az mysql flexible-server update --resource-group testGroup --name testserver --tags "k1=v1" "k2=v2"
Set or change key and identity for data encryption.
# get key identifier of the existing key
newKeyIdentifier=$(az keyvault key show --vault-name testVault --name testKey \
--query key.kid -o tsv)
# update server with new key/identity
az mysql flexible-server update --resource-group testGroup --name testserver \
--key $newKeyIdentifier --identity newIdentity
Set or change key, identity, backup key and backup identity for data encryption with geo redundant backup.
# get key identifier of the existing key and backup key
newKeyIdentifier=$(az keyvault key show --vault-name testVault --name testKey \
--query key.kid -o tsv)
newBackupKeyIdentifier=$(az keyvault key show --vault-name testBackupVault \
--name testBackupKey --query key.kid -o tsv)
# update server with new key/identity and backup key/identity
az mysql flexible-server update --resource-group testGroup --name testserver \
--key $newKeyIdentifier --identity newIdentity \
--backup-key $newBackupKeyIdentifier --backup-identity newBackupIdentity
Disable data encryption for flexible server.
az mysql flexible-server update --resource-group testGroup --name testserver \
--disable-data-encryption
Optional Parameters
Enable or disable accelerated logs. Only support for Business Critical tier. Default value is Enabled.
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>
.
The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.
Enable or disable the auto scale iops. Default value is Disabled.
The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.
The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.
The number of days a backup is retained. Range of 1 to 35 days. Default is 7 days.
Disable data encryption by removing key(s).
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
Whether or not geo redundant backup is enabled.
Enable (ZoneRedundant or SameZone) or disable high availability feature.
The name or resource ID of the user assigned identity for data encryption.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Number of IOPS to be allocated for this server. You will get certain amount of free IOPS based on compute and storage provisioned. The default value for IOPS is free IOPS. To learn more about IOPS based on compute and storage, refer to IOPS in Azure Database for MySQL Flexible Server.
The resource ID of the primary keyvault key for data encryption.
Period of time (UTC) designated for maintenance. Examples: "Sun:23:30" to schedule on Sunday, 11:30pm UTC. To set back to default pass in "Disabled".
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Enable or disable the public access on a server.
Remove a property or an element from a list. Example: --remove property.list <indexToRemove>
OR --remove propertyToRemove
.
The replication role of the server.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>
.
The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms.
The availability zone information of the standby server when high availability is enabled.
Enable or disable autogrow of the storage. Default value is Enabled.
The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Compute tier of the server. Accepted values: Burstable, GeneralPurpose, MemoryOptimized.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server upgrade
Upgrade the major version of a flexible server.
az mysql flexible-server upgrade --version {8}
[--ids]
[--name]
[--resource-group]
[--subscription]
[--yes]
Examples
Upgrade server 'testsvr' to MySQL major version 8.
# make sure that sql_mode only contains values allowed in new version, for example:
az mysql flexible-server parameter set -g testgroup -s testsvr -n sql_mode \
-v "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO"
# upgrade server to MySQL major version 8.
az mysql flexible-server upgrade -g testgroup -n testsvr -v 8
Required Parameters
Server major version.
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az mysql flexible-server wait
Wait for the flexible server to satisfy certain conditions.
az mysql flexible-server wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]
Examples
Wait for the flexible server to satisfy certain conditions.
az mysql flexible-server wait --exists --resource-group testGroup --name testserver
Optional Parameters
Wait until created with 'provisioningState' at 'Succeeded'.
Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].
Wait until deleted.
Wait until the resource exists.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Polling interval in seconds.
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Maximum wait in seconds.
Wait until updated with provisioningState at 'Succeeded'.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Azure CLI