get Server
Use this data source to access information about an existing MySQL Server.
Note: Azure Database for MySQL Single Server and its sub resources are scheduled for retirement by 2024-09-16 and will migrate to using Azure Database for MySQL Flexible Server: https://go.microsoft.com/fwlink/?linkid=2216041. The
azure.mysql.Server
data source is deprecated and will be removed in v4.0 of the AzureRM Provider. Please use theazure.mysql.FlexibleServer
data source instead.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.mysql.getServer({
name: "existingMySqlServer",
resourceGroupName: "existingResGroup",
});
export const id = example.then(example => example.id);
import pulumi
import pulumi_azure as azure
example = azure.mysql.get_server(name="existingMySqlServer",
resource_group_name="existingResGroup")
pulumi.export("id", example.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.MySql.GetServer.Invoke(new()
{
Name = "existingMySqlServer",
ResourceGroupName = "existingResGroup",
});
return new Dictionary<string, object?>
{
["id"] = example.Apply(getServerResult => getServerResult.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mysql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := mysql.LookupServer(ctx, &mysql.LookupServerArgs{
Name: "existingMySqlServer",
ResourceGroupName: "existingResGroup",
}, nil)
if err != nil {
return err
}
ctx.Export("id", example.Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.mysql.MysqlFunctions;
import com.pulumi.azure.mysql.inputs.GetServerArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = MysqlFunctions.getServer(GetServerArgs.builder()
.name("existingMySqlServer")
.resourceGroupName("existingResGroup")
.build());
ctx.export("id", example.applyValue(getServerResult -> getServerResult.id()));
}
}
variables:
example:
fn::invoke:
Function: azure:mysql:getServer
Arguments:
name: existingMySqlServer
resourceGroupName: existingResGroup
outputs:
id: ${example.id}
Return
A collection of values returned by getServer.
Parameters
A collection of arguments for invoking getServer.
Return
A collection of values returned by getServer.
Parameters
Specifies the name of the MySQL Server.
The name of the resource group for the MySQL Server.
See also
Return
A collection of values returned by getServer.
Parameters
Builder for com.pulumi.azure.mysql.kotlin.inputs.GetServerPlainArgs.