azureazure-mysql-database

unrecognized arguments: --location while creating the Azure Mysql Flexi -Server Replica create


The requirement is to implement Cross-region replication using Azure MySQL Flexi server DB. From the Azure portal, have the option to choose a location while creating the replica. enter image description here

The same replica creation we are trying to achieve via commands, getting the below issue. The source server is in the west region, would like to create a replica in the east region.

Note: Both primary and secondary servers are in the same RG.

az mysql flexible-server replica create --replica-name az-flexi-master-west-dr -g primary-DB --source-server az-flexi-master --location eastus

unrecognized arguments: --location eastus

followed this:https://learn.microsoft.com/en-us/cli/azure/mysql/flexible-server/replica?view=azure-cli-latest

Do we have the possibility to provide a location argument while creating the Azure mysql Flexi server replica?


Solution

  • Yes, it's possible to provide --location argument while creating Azure MySQL Flexible Server Replica. You can also create replica in the same location as the source server.

    I created one Azure MySQL Flexible Server with same properties as you in West US location like this:

    enter image description here

    To create Azure MySQL Flexible Server Replica in above server via CLI, I ran same command with --location argument and got response like this:

    az mysql flexible-server replica create --replica-name az-flexi-master-west-dr -g primary-DB --source-server az-flexi-master --location eastus
    

    Response:

    enter image description here

    To confirm that, I checked the same in Portal where replica created successfully in East US location:

    enter image description here

    When I checked the resource group, it has both servers with East US and West US locations:

    enter image description here

    To check the installed version of Azure CLI, you can use az version command:

    enter image description here

    In your case, check what CLI version you are currently using and upgrade it to latest version by running az upgrade command.

    When I tried to create replica in same location as the source server, it created successfully like below:

    az mysql flexible-server replica create --replica-name az-flexi-master-west-dr -g primary-DB --source-server az-flexi-master1 --location westus
    

    Response:

    enter image description here

    Reference: az mysql flexible-server replica | Microsoft