Edit

Share via


Test-AzMySqlFlexibleServerConnect

Test out the connection to the database server

Syntax

Test (Default)

Test-AzMySqlFlexibleServerConnect
    -Name <String>
    -ResourceGroupName <String>
    -AdministratorLoginPassword <SecureString>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

TestAndQuery

Test-AzMySqlFlexibleServerConnect
    -Name <String>
    -ResourceGroupName <String>
    -QueryText <String>
    -AdministratorLoginPassword <SecureString>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

TestViaIdentityAndQuery

Test-AzMySqlFlexibleServerConnect
    -QueryText <String>
    -AdministratorLoginPassword <SecureString>
    -InputObject <IMySqlIdentity>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

TestViaIdentity

Test-AzMySqlFlexibleServerConnect
    -AdministratorLoginPassword <SecureString>
    -InputObject <IMySqlIdentity>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

Description

Test out the connection to the database server

Examples

Example 1: Test connection by name

$password = ConvertTo-SecureString <YourPassword> -AsPlainText
Test-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest -Name mysql-test -AdministratorLoginPassword $password
The connection testing to mysql-test.database.azure.com was successful!

Test connection by the resource group and the server name

Example 2: Test connection by identity

$password = ConvertTo-SecureString <YourPassword> -AsPlainText
Get-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Test-AzMySqlFlexibleServerConnect -AdministratorLoginPassword $password
The connection testing to mysql-test.database.azure.com was successful!

Test connection by the identity

Example 3: Test query by name

$password = ConvertTo-SecureString <YourPassword> -AsPlainText
Test-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest -Name mysql-test -AdministratorLoginPassword $password -QueryText "SELECT * FROM test"
col
-----
1
2
3

Test a query by the resource group and the server name

Example 4: Test connection by identity

Get-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Test-AzMySqlFlexibleServerConnect -QueryText "SELECT * FROM test" -AdministratorLoginPassword $password
col
-----
1
2
3

Test a query by the identity

Parameters

-AdministratorLoginPassword

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.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AdministratorUserName

Administrator username for the server. Once set, it cannot be changed.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DatabaseName

The database name to connect.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

The server to connect. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

Parameter properties

Type:IMySqlIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

TestViaIdentityAndQuery
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
TestViaIdentity
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The name of the server to connect.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ServerName

Parameter sets

Test
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
TestAndQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-QueryText

The query for the database to test

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

TestAndQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
TestViaIdentityAndQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Test
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
TestAndQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

IMySqlIdentity

Outputs

String