Editar

Compartilhar via


Get-AzMySqlConnectionString

Get the connection string according to client connection provider.

Syntax

Get-AzMySqlConnectionString
   -Client <String>
   -Name <String>
   -ResourceGroupName <String>
   [-SubscriptionId <String>]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzMySqlConnectionString
   -Client <String>
   -InputObject <IServer>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]

Description

Get the connection string according to client connection provider.

Examples

Example 1: Get MySql server connection string by resource group and server name

Get-AzMySqlConnectionString -Client ADO.NET -Name mysql-test -ResourceGroupName PowershellMySqlTest

Server=mysql-test.mysql.database.azure.com; Port=3306; Database={your_database}; Uid=mysql_test@mysql-test; Pwd={your_password};

This cmdlet gets MySql server connection string by resource group and server name.

Example 2: Get MySql server connection string by identity

Get-AzMySqlServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Get-AzMySqlConnectionString -Client PHP

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

This cmdlet gets MySql server connection string by identity.

Parameters

-Client

Client connection provider.

Type:String
Position:Named
Default value:None
Required:True
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 for the connection string. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

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

-Name

The name of the server.

Type:String
Aliases:ServerName
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

-SubscriptionId

The subscription ID that identifies an Azure subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IServer

Outputs

String