Introducing the MySQL Flexible Server PowerShell Module

Published 04-21-2021 02:08 PM 1,415 Views
Microsoft

Late last year, the Open-Source Databases on Azure Team announced the Preview release of Azure Database for MySQL Flexible Server to provide customers with greater control and manageability. Today, we’re pleased to let you know that the PowerShell module for MySQL Flexible Server is now available. Developers can now use PowerShell to manage MySQL Flexible Servers and dependent resources. Detailed development documentation and examples are available in the topic Az.MySql.

 

Provision a server quickly and easily 

To provision an instance of MySQL Flexible Server, developers can run the following command:

 

 

 

 

$server = New-AzMySqlFlexibleServer

Creating Resource Group group28382412... 
Creating new vnet vnet-server2867384 in resource group group28382412... 
Creating new subnet subnet- server2867384 in resource group group28382412 and delegating it to Microsoft.DBforMySQL/flexibleServers... 
Creating MySQL server server2867384... 
Your server is using sku Standard_D2ds_V4 (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details... 
Creating database flexibleserverdb... 

 

 

 

 

mysql create.PNG

The example above shows that the module creates the associated resource group, default database, and network resource – the default network option is to create a server within a VNET and subnet.

 

Server properties (e.g., location, SKU, storage size etc.) are set to default values. To see all the properties in the $server object, run to following command:

 

Write-Host ($server | Format-List | Out-String) 

 

For example, the generated password is saved as a SecureString in SecuredPassword.

 

Provision a server with private or public access 

To set up an instance of MySQL Flexible Server more quickly, the New-AzMySqlFlexibleServer cmdlet provides options for private and public accessibility. As a result, you can create a server with a private network or a network open to public access. The detailed scenarios are below.

 

Private access

To set up a network with private access, use the following commands.

 

Scenario Command
Existing VNET and Subnet (name or resource Id) New-AzMySqlFlexibleServer –Vnet <vnet name/Id> -Subnet <subnet name/Id>
Existing VNET (name or resource Id)  New-AzMySqlFlexibleServer -Vnet <vnet name/Id> 
New VNET and Subnet – provide name New-AzMySqlFlexibleServer -Vnet <vnet name> -Subnet <subnet name> -VnetPrefix 10.0.0.0/16 -SubnetPrefix 10.0.0.0/24 

 

Public access

To set up a network with public access, use the following commands.

 

Scenario Command
Allow all IPs from 0.0.0.0-255.255.255.255 New-AzMySqlFlexibleServer -PublicAccess All
Allow access to your client IP only New-AzMySqlFlexibleServer -PublicAccess <Client IP>
Allow all IPs within a range New-AzMySqlFlexibleServer -PublicAccess <Start IP>-<End IP>
Allow access to all Azure Services New-AzMySqlFlexibleServer -PublicAccess 0.0.0.0
No public access, but add allowed IPs later* New-AzMySqlFlexibleServer -PublicAccess none

*You need to add allowed IPs using the `New-AzMySqlFlexibleServerFirewallRule` command.

 

Connect to your server easily 

After provisioning your instance of MySQL Flexible Server, you can easily test the connection and obtain the connection string in the programming language you are using.

 

To test the connection to your server and try out a simple query, use the Test-AzMySqlFlexibleServerConnect cmdlet 

 

 

 

 

PS C:\> Get-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest \
-Name mysql-test -AdministratorLoginPassword $password 

The connection testing to mysql-test.database.azure.com was successful!

PS C:\> Get-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest \
-Name mysql-test -AdministratorLoginPassword $password -Query "SELECT * FROM test"  

col  
-----  
1  
2 

 

 

 

 

To obtain the connection string for programming language in which you are developing, use the Get-AzMySqlFlexibleServerConnectionString cmdlet.

 

 

 

 

PS C:\> Get-AzMySqlFlexibleServerConnectionString -Client Python \
-ResourceGroupName PowershellMySqlTest -Name mysql-test  

cnx = mysql.connector.connect(user=mysql_user, password="{your_password}", host="mysql-test.mysql.database.azure.com", port=3306, database="{your_database}", ssl_ca="{ca-cert filename}", ssl_disabled=False)

PS C:\> Get-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest \
-ServerName mysql-test | Get-AzMySqlFlexibleServerConnectionString -Client PHP  

$con=mysqli_init(); mysqli_real_connect($con, "mysql-test.mysql.database.azure.com", "mysql_test", {your_password}, {your_database}, 3306); 

 

 

 

Additional resources

For more information, consult the following resources.

 

You can also manage MySQL Flexible Servers by using the Azure CLI or SDKs at your convenience. To develop on other platforms, check out the following resources.

%3CLINGO-SUB%20id%3D%22lingo-sub-2203383%22%20slang%3D%22en-US%22%3EIntroducing%20the%20MySQL%20Flexible%20Server%20PowerShell%20Module%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2203383%22%20slang%3D%22en-US%22%3E%3CP%3ELate%20last%20year%2C%20the%20Open-Source%20Databases%20on%20Azure%20Team%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-mysql%2Fannouncing-flexible-server-for-azure-database-for-mysql%2Fba-p%2F1686617%22%20target%3D%22_blank%22%3Eannounced%20the%20Preview%20release%3C%2FA%3E%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmysql%2Fflexible-server%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Database%20for%20MySQL%20Flexible%20Server%3C%2FA%3E%20to%20provide%20customers%20with%20greater%20control%20and%20manageability.%20Today%2C%20we%E2%80%99re%20pleased%20to%20let%20you%20know%20that%20the%20PowerShell%20module%20for%20MySQL%20Flexible%20Server%20is%20now%20available.%20Developers%20can%20now%20use%20PowerShell%20to%20manage%20MySQL%20Flexible%20Servers%20and%20dependent%20resources.%20Detailed%20development%20documentation%20and%20examples%20are%20available%20in%20the%20topic%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fpowershell%2Fmodule%2Faz.mysql%2F%3Fview%3Dazps-5.6.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAz.MySql%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--492793391%22%20id%3D%22toc-hId--500241045%22%3E%3CSPAN%20class%3D%22EOP%20SCXW10339726%20BCX8%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CSPAN%20class%3D%22TextRun%20SCXW108237764%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW108237764%20BCX8%22%3EProvision%20a%20server%26nbsp%3Bquickly%20and%20easily%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22EOP%20SCXW108237764%20BCX8%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3ETo%20provision%20an%20instance%20of%20MySQL%20Flexible%20Server%2C%20developers%20can%20run%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24server%20%3D%26nbsp%3BNew-AzMySqlFlexibleServer%0A%0ACreating%20Resource%20Group%20group28382412...%26nbsp%3B%0ACreating%20new%26nbsp%3Bvnet%26nbsp%3Bvnet-server2867384%20in%20resource%20group%20group28382412...%26nbsp%3B%0ACreating%20new%20subnet%26nbsp%3Bsubnet-%20server2867384%20in%20resource%20group%20group28382412%20and%20delegating%20it%20to%26nbsp%3BMicrosoft.DBforMySQL%2FflexibleServers...%26nbsp%3B%0ACreating%20MySQL%20server%20server2867384...%26nbsp%3B%0AYour%20server%20is%20using%26nbsp%3Bsku%26nbsp%3BStandard_D2ds_V4%20(Paid%20Tier).%20Please%20refer%20to%26nbsp%3Bhttps%3A%2F%2Faka.ms%2Fmysql-pricing%26nbsp%3Bfor%20pricing%20details...%26nbsp%3B%0ACreating%20database%26nbsp%3Bflexibleserverdb...%26nbsp%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH6%20id%3D%22toc-hId--898118698%22%20id%3D%22toc-hId--905566352%22%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22mysql%20create.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F262888i7467FF044679F244%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22mysql%20create.PNG%22%20alt%3D%22mysql%20create.PNG%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FH6%3E%0A%3CP%3EThe%20example%20above%20shows%20that%20the%20module%20creates%20the%20associated%20resource%20group%2C%20default%20database%2C%20and%20network%20resource%20%E2%80%93%20the%20default%20network%20option%20is%20to%20create%20a%20server%20within%20a%20VNET%20and%20subnet.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EServer%20properties%20(e.g.%2C%20location%2C%20SKU%2C%20storage%20size%20etc.)%20are%20set%20to%20default%20values.%20To%20see%20all%20the%20properties%20in%20the%20%3CSTRONG%3E%24server%3C%2FSTRONG%3E%20object%2C%20run%20to%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%20data-contrast%3D%22none%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3EWrite-Host%20(%24server%20%7C%20Format-List%20%7C%20Out-String)%26nbsp%3B%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20example%2C%20the%20generated%20password%20is%20saved%20as%20a%20%3CSTRONG%3ESecureString%3C%2FSTRONG%3E%20in%20%3CSTRONG%3ESecuredPassword%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-187264979%22%20id%3D%22toc-hId-179817325%22%3E%3CSPAN%20class%3D%22TextRun%20SCXW97784865%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW97784865%20BCX8%22%3EProvision%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22TextRun%20SCXW97784865%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW97784865%20BCX8%22%3E%26nbsp%3Ba%20s%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22TextRun%20SCXW97784865%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW97784865%20BCX8%22%3Eerver%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22TextRun%20SCXW97784865%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW97784865%20BCX8%22%3Ewith%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22TextRun%20SCXW97784865%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW97784865%20BCX8%22%3E%26nbsp%3Bprivate%20or%20public%20access%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22EOP%20SCXW97784865%20BCX8%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335551550%26quot%3B%3A1%2C%26quot%3B335551620%26quot%3B%3A1%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CSPAN%20class%3D%22EOP%20SCXW97784865%20BCX8%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CSPAN%20class%3D%22TextRun%20SCXW4738614%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW4738614%20BCX8%22%3ETo%20set%20up%20an%20instance%20of%20MySQL%20Flexible%20Server%20more%20quickly%2C%20the%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CA%20class%3D%22Hyperlink%20SCXW4738614%20BCX8%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.mysql%2Fnew-azmysqlflexibleserver%3Fview%3Dazps-5.5.0%22%20target%3D%22_blank%22%20rel%3D%22noreferrer%20noopener%22%3E%3CSPAN%20class%3D%22TextRun%20Underlined%20SCXW4738614%20BCX8%22%20data-contrast%3D%22none%22%3E%3CSPAN%20class%3D%22NormalTextRun%20CommentStart%20SCXW4738614%20BCX8%22%20data-ccp-charstyle%3D%22Hyperlink%22%3ENe%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22TextRun%20Underlined%20SCXW4738614%20BCX8%22%20data-contrast%3D%22none%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW4738614%20BCX8%22%20data-ccp-charstyle%3D%22Hyperlink%22%3Ew-%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22TextRun%20Underlined%20SCXW4738614%20BCX8%22%20data-contrast%3D%22none%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW4738614%20BCX8%22%20data-ccp-charstyle%3D%22Hyperlink%22%3EAzMySqlFlexibleServer%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20class%3D%22TextRun%20SCXW4738614%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW4738614%20BCX8%22%3E%20cmdlet%20provides%20options%20for%20private%20and%20public%20accessibility.%20As%20a%20result%2C%20you%20can%20create%20a%20server%20with%20a%20private%20network%20or%20a%20network%20open%20to%20public%20access.%20The%20detailed%20scenarios%20are%20below.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-877826453%22%20id%3D%22toc-hId-870378799%22%3EPrivate%20access%3C%2FH3%3E%0A%3CP%3ETo%20set%20up%20a%20network%20with%20private%20access%2C%20use%20the%20following%20commands.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSTRONG%3EScenario%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSTRONG%3ECommand%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2256px%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EExisting%20VNET%20and%20Subnet%20(name%20or%20resource%20Id)%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2256px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B%E2%80%93Vnet%26nbsp%3B%3CVNET%3E%26nbsp%3B-Subnet%26nbsp%3B%3CSUBNET%20name%3D%22%22%3E%3C%2FSUBNET%3E%3C%2FVNET%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EExisting%20VNET%20(name%20or%20resource%20Id)%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-Vnet%26nbsp%3B%3CVNET%3E%26nbsp%3B%3C%2FVNET%3E%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2256px%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3ENew%20VNET%20and%20Subnet%20%E2%80%93%20provide%20name%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2256px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-Vnet%26nbsp%3B%3CVNET%3E%26nbsp%3B-Subnet%26nbsp%3B%3CSUBNET%20name%3D%22%22%3E%26nbsp%3B-VnetPrefix%26nbsp%3B10.0.0.0%2F16%20-SubnetPrefix%26nbsp%3B10.0.0.0%2F24%26nbsp%3B%3C%2FSUBNET%3E%3C%2FVNET%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--929628010%22%20id%3D%22toc-hId--937075664%22%3EPublic%20access%3C%2FH3%3E%0A%3CP%3ETo%20set%20up%20a%20network%20with%20public%20access%2C%20use%20the%20following%20commands.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSTRONG%3EScenario%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSTRONG%3ECommand%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAllow%20all%20IPs%20from%200.0.0.0-255.255.255.255%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-PublicAccess%26nbsp%3BAll%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAllow%20access%20to%20your%20client%20IP%20only%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-PublicAccess%26nbsp%3B%3CCLIENT%20ip%3D%22%22%3E%3C%2FCLIENT%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAllow%20all%20IPs%20within%20a%20range%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-PublicAccess%26nbsp%3B%3CSTART%20ip%3D%22%22%3E-%3CEND%20ip%3D%22%22%3E%3C%2FEND%3E%3C%2FSTART%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAllow%20access%20to%20all%20Azure%20Services%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-PublicAccess%26nbsp%3B0.0.0.0%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ENo%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Epublic%20access%2C%20but%20add%20allowed%20IPs%20later%3CSTRONG%3E*%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2229px%22%3E%3CCODE%20style%3D%22color%3A%20black%3B%22%3ENew-AzMySqlFlexibleServer%26nbsp%3B-PublicAccess%26nbsp%3Bnone%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3E*%3C%2FSTRONG%3EYou%20need%20to%20add%20allowed%20IPs%20using%20the%20%60New-AzMySqlFlexibleServerFirewallRule%60%20command.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--940131114%22%20id%3D%22toc-hId--947578768%22%3EConnect%20to%20your%20server%20easily%26nbsp%3B%3C%2FH2%3E%0A%3CP%3EAfter%20provisioning%20your%20instance%20of%20MySQL%20Flexible%20Server%2C%20you%20can%20easily%20test%20the%20connection%20and%20obtain%20the%20connection%20string%20in%20the%20programming%20language%20you%20are%20using.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20test%20the%20connection%20to%20your%20server%20and%20try%20out%20a%20simple%20query%2C%20use%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.mysql%2Ftest-azmysqlflexibleserverconnect%3Fview%3Dazps-5.5.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ETest-%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAzMySqlFlexibleServerConnect%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecmdlet%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EPS%20C%3A%5C%26gt%3B%26nbsp%3BGet-AzMySqlFlexibleServerConnect%26nbsp%3B-ResourceGroupName%26nbsp%3BPowershellMySqlTest%26nbsp%3B%5C%0A-Name%26nbsp%3Bmysql-test%26nbsp%3B-AdministratorLoginPassword%26nbsp%3B%24password%26nbsp%3B%0A%0AThe%20connection%20testing%20to%26nbsp%3Bmysql-test.database.azure.com%20was%20successful!%0A%0APS%20C%3A%5C%26gt%3B%26nbsp%3BGet-AzMySqlFlexibleServerConnect%26nbsp%3B-ResourceGroupName%26nbsp%3BPowershellMySqlTest%26nbsp%3B%5C%0A-Name%26nbsp%3Bmysql-test%26nbsp%3B-AdministratorLoginPassword%26nbsp%3B%24password%26nbsp%3B-Query%26nbsp%3B%22SELECT%20*%20FROM%20test%22%26nbsp%3B%26nbsp%3B%0A%0Acol%26nbsp%3B%26nbsp%3B%0A-----%26nbsp%3B%26nbsp%3B%0A1%26nbsp%3B%26nbsp%3B%0A2%26nbsp%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20obtain%20the%20connection%20string%20for%20programming%20language%20in%20which%20you%20are%20developing%2C%20use%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.mysql%2Fget-azmysqlflexibleserverconnectionstring%3Fview%3Dazps-5.5.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EGet-%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAzMySqlFlexibleServerConnectionString%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecmdlet.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EPS%20C%3A%5C%26gt%3B%26nbsp%3BGet-AzMySqlFlexibleServerConnectionString%26nbsp%3B-Client%26nbsp%3BPython%26nbsp%3B%5C%0A-ResourceGroupName%26nbsp%3BPowershellMySqlTest%26nbsp%3B-Name%26nbsp%3Bmysql-test%26nbsp%3B%26nbsp%3B%0A%0Acnx%26nbsp%3B%3D%26nbsp%3Bmysql.connector.connect(user%3Dmysql_user%2C%20password%3D%22%7Byour_password%7D%22%2C%20host%3D%22mysql-test.mysql.database.azure.com%22%2C%20port%3D3306%2C%20database%3D%22%7Byour_database%7D%22%2C%26nbsp%3Bssl_ca%3D%22%7Bca-cert%20filename%7D%22%2C%26nbsp%3Bssl_disabled%3DFalse)%0A%0APS%20C%3A%5C%26gt%3B%26nbsp%3BGet-AzMySqlFlexibleServer%26nbsp%3B-ResourceGroupName%26nbsp%3BPowershellMySqlTest%26nbsp%3B%5C%0A-ServerName%26nbsp%3Bmysql-test%26nbsp%3B%7C%26nbsp%3BGet-AzMySqlFlexibleServerConnectionString%26nbsp%3B-Client%26nbsp%3BPHP%26nbsp%3B%26nbsp%3B%0A%0A%24con%3Dmysqli_init()%3B%26nbsp%3Bmysqli_real_connect(%24con%2C%26nbsp%3B%22mysql-test.mysql.database.azure.com%22%2C%26nbsp%3B%22mysql_test%22%2C%20%7Byour_password%7D%2C%20%7Byour_database%7D%2C%203306)%3B%26nbsp%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1547381719%22%20id%3D%22toc-hId-1539934065%22%3EAdditional%20resources%3C%2FH2%3E%0A%3CP%3EFor%20more%20information%2C%20consult%20the%20following%20resources.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETo%20try%20out%20the%20new%20module%2C%20use%20Azure%20Cloud%20Shell%20(%3CA%20href%3D%22https%3A%2F%2Fshell.azure.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fshell.azure.com%3C%2FA%3E)%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20portal%3C%2FA%3E%20or%20download%20the%20Az.MySQL%20module%20(%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAz%2F5.5.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EPowerShell%20Gallery%20%7C%20Az%205.5.0%3C%2FA%3E).%3C%2FLI%3E%0A%3CLI%3ETo%20learn%20more%20about%20MySQL%20Flexible%20Server%2C%20see%20the%20blog%20post%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-mysql%2Fwhat-is-flexible-server-in-azure-database-for-mysql%2Fba-p%2F1770997%22%20target%3D%22_blank%22%3EWhat%20is%20Flexible%20Server%20in%20Azure%20Database%20for%20MySQL%3F%3C%2FA%3E%20or%20refer%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmysql%2Fflexible-server%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Database%20for%20MySQL%20Flexible%20Server%3C%2FA%3E%20documentation.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20manage%20MySQL%20Flexible%20Servers%20by%20using%20the%20Azure%20CLI%20or%20SDKs%20at%20your%20convenience.%20To%20develop%20on%20other%20platforms%2C%20check%20out%20the%20following%20resources.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmysql%2Fflexible-server%2Fquickstart-create-server-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EQuickstart%3A%20Create%20a%20server%20-%20Azure%20CLI%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmysql%2Fflexible-server%2Fquickstart-create-arm-template%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EQuickstart%3A%20Create%20a%20server%20-%20ARM%20template%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fpypi.org%2Fproject%2Fazure-mgmt-rdbms%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20SDK%20for%20Python%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fpkg.go.dev%2Fgithub.com%2FAzure%2Fazure-sdk-for-go%40v51.2.0%2Bincompatible%2Fservices%2Fpreview%2Fmysql%2Fmgmt%2F2020-07-01-preview%2Fmysqlflexibleservers%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20SDK%20for%20GO%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Azure.Management.MySQL%2F0.1.0-preview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20SDK%20for%20.NET%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2203383%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20we%E2%80%99re%20pleased%20to%20let%20you%20know%20that%20the%20PowerShell%20module%20for%20MySQL%20Flexible%20Server%20is%20now%20available.%20Developers%20can%20use%20now%20use%20PowerShell%20to%20manage%20MySQL%20Flexible%20Servers%20and%20dependent%20resources.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22mysql%20create.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F262888i7467FF044679F244%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22mysql%20create.PNG%22%20alt%3D%22mysql%20create.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Co-Authors
Version history
Last update:
‎Apr 30 2021 11:43 AM
Updated by: