Test-AzMySqlFlexibleServerConnect

Test out the connection to the database server

Syntax

Test-AzMySqlFlexibleServerConnect
    -Name <String>
    -ResourceGroupName <String>
    -AdministratorLoginPassword <SecureString>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]
Test-AzMySqlFlexibleServerConnect
    -Name <String>
    -QueryText <String>
    -ResourceGroupName <String>
    -AdministratorLoginPassword <SecureString>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]
Test-AzMySqlFlexibleServerConnect
    -AdministratorLoginPassword <SecureString>
    -InputObject <IMySqlIdentity>
    [-DatabaseName <String>]
    [-AdministratorUserName <String>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]
Test-AzMySqlFlexibleServerConnect
    -QueryText <String>
    -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.

Type:SecureString
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AdministratorUserName

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DatabaseName

The database name to connect.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

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

Type:IMySqlIdentity
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the server to connect.

Type:String
Aliases:ServerName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-QueryText

The query for the database to test

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IMySqlIdentity

Outputs

String

Notes

ALIASES

COMPLEX PARAMETER PROPERTIES

To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.

INPUTOBJECT <IMySqlIdentity>: The server to connect.

  • [BackupName <String>]: The name of the backup.
  • [ConfigurationName <String>]: The name of the server configuration.
  • [DatabaseName <String>]: The name of the database.
  • [FirewallRuleName <String>]: The name of the server firewall rule.
  • [Id <String>]: Resource identity path
  • [LocationName <String>]: The name of the location.
  • [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive.
  • [SecurityAlertPolicyName <SecurityAlertPolicyName?>]: The name of the security alert policy.
  • [ServerName <String>]: The name of the server.
  • [SubscriptionId <String>]: The ID of the target subscription.
  • [VirtualNetworkRuleName <String>]: The name of the virtual network rule.