We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
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.Serverdata source is deprecated and will be removed in v4.0 of the AzureRM Provider. Please use theazure.mysql.FlexibleServerdata 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)
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
})
}
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 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}
Using getServer
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getServer(args: GetServerArgs, opts?: InvokeOptions): Promise<GetServerResult>
function getServerOutput(args: GetServerOutputArgs, opts?: InvokeOptions): Output<GetServerResult>def get_server(name: Optional[str] = None,
resource_group_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetServerResult
def get_server_output(name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServerResult]func LookupServer(ctx *Context, args *LookupServerArgs, opts ...InvokeOption) (*LookupServerResult, error)
func LookupServerOutput(ctx *Context, args *LookupServerOutputArgs, opts ...InvokeOption) LookupServerResultOutput> Note: This function is named LookupServer in the Go SDK.
public static class GetServer
{
public static Task<GetServerResult> InvokeAsync(GetServerArgs args, InvokeOptions? opts = null)
public static Output<GetServerResult> Invoke(GetServerInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
public static Output<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
fn::invoke:
function: azure:mysql/getServer:getServer
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- Specifies the name of the MySQL Server.
- Resource
Group stringName - The name of the resource group for the MySQL Server.
- Name string
- Specifies the name of the MySQL Server.
- Resource
Group stringName - The name of the resource group for the MySQL Server.
- name String
- Specifies the name of the MySQL Server.
- resource
Group StringName - The name of the resource group for the MySQL Server.
- name string
- Specifies the name of the MySQL Server.
- resource
Group stringName - The name of the resource group for the MySQL Server.
- name str
- Specifies the name of the MySQL Server.
- resource_
group_ strname - The name of the resource group for the MySQL Server.
- name String
- Specifies the name of the MySQL Server.
- resource
Group StringName - The name of the resource group for the MySQL Server.
getServer Result
The following output properties are available:
- Administrator
Login string - The Administrator login for the MySQL Server.
- Auto
Grow boolEnabled - The auto grow setting for this MySQL Server.
- Backup
Retention intDays - The backup retention days for this MySQL server.
- Fqdn string
- The FQDN of the MySQL Server.
- Geo
Redundant boolBackup Enabled - The geo redundant backup setting for this MySQL Server.
- Id string
- The provider-assigned unique ID for this managed resource.
- Identities
List<Get
Server Identity> - An
identityblock as defined below. - Infrastructure
Encryption boolEnabled - Whether or not infrastructure is encrypted for this MySQL Server.
- Location string
- The Azure location where the resource exists.
- Name string
- Public
Network boolAccess Enabled - Whether or not public network access is allowed for this MySQL Server.
- Resource
Group stringName - Restore
Point stringIn Time - Sku
Name string - The SKU Name for this MySQL Server.
- Ssl
Enforcement boolEnabled - Specifies if SSL should be enforced on connections for this MySQL Server.
- Ssl
Minimal stringTls Version Enforced - The minimum TLS version to support for this MySQL Server.
- Storage
Mb int - Max storage allowed for this MySQL Server.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Threat
Detection List<GetPolicies Server Threat Detection Policy> - Threat detection policy configuration, known in the API as Server Security Alerts Policy. The
threat_detection_policyblock exports fields documented below. - Version string
- The version of this MySQL Server.
- Administrator
Login string - The Administrator login for the MySQL Server.
- Auto
Grow boolEnabled - The auto grow setting for this MySQL Server.
- Backup
Retention intDays - The backup retention days for this MySQL server.
- Fqdn string
- The FQDN of the MySQL Server.
- Geo
Redundant boolBackup Enabled - The geo redundant backup setting for this MySQL Server.
- Id string
- The provider-assigned unique ID for this managed resource.
- Identities
[]Get
Server Identity - An
identityblock as defined below. - Infrastructure
Encryption boolEnabled - Whether or not infrastructure is encrypted for this MySQL Server.
- Location string
- The Azure location where the resource exists.
- Name string
- Public
Network boolAccess Enabled - Whether or not public network access is allowed for this MySQL Server.
- Resource
Group stringName - Restore
Point stringIn Time - Sku
Name string - The SKU Name for this MySQL Server.
- Ssl
Enforcement boolEnabled - Specifies if SSL should be enforced on connections for this MySQL Server.
- Ssl
Minimal stringTls Version Enforced - The minimum TLS version to support for this MySQL Server.
- Storage
Mb int - Max storage allowed for this MySQL Server.
- map[string]string
- A mapping of tags to assign to the resource.
- Threat
Detection []GetPolicies Server Threat Detection Policy - Threat detection policy configuration, known in the API as Server Security Alerts Policy. The
threat_detection_policyblock exports fields documented below. - Version string
- The version of this MySQL Server.
- administrator
Login String - The Administrator login for the MySQL Server.
- auto
Grow BooleanEnabled - The auto grow setting for this MySQL Server.
- backup
Retention IntegerDays - The backup retention days for this MySQL server.
- fqdn String
- The FQDN of the MySQL Server.
- geo
Redundant BooleanBackup Enabled - The geo redundant backup setting for this MySQL Server.
- id String
- The provider-assigned unique ID for this managed resource.
- identities
List<Get
Server Identity> - An
identityblock as defined below. - infrastructure
Encryption BooleanEnabled - Whether or not infrastructure is encrypted for this MySQL Server.
- location String
- The Azure location where the resource exists.
- name String
- public
Network BooleanAccess Enabled - Whether or not public network access is allowed for this MySQL Server.
- resource
Group StringName - restore
Point StringIn Time - sku
Name String - The SKU Name for this MySQL Server.
- ssl
Enforcement BooleanEnabled - Specifies if SSL should be enforced on connections for this MySQL Server.
- ssl
Minimal StringTls Version Enforced - The minimum TLS version to support for this MySQL Server.
- storage
Mb Integer - Max storage allowed for this MySQL Server.
- Map<String,String>
- A mapping of tags to assign to the resource.
- threat
Detection List<GetPolicies Server Threat Detection Policy> - Threat detection policy configuration, known in the API as Server Security Alerts Policy. The
threat_detection_policyblock exports fields documented below. - version String
- The version of this MySQL Server.
- administrator
Login string - The Administrator login for the MySQL Server.
- auto
Grow booleanEnabled - The auto grow setting for this MySQL Server.
- backup
Retention numberDays - The backup retention days for this MySQL server.
- fqdn string
- The FQDN of the MySQL Server.
- geo
Redundant booleanBackup Enabled - The geo redundant backup setting for this MySQL Server.
- id string
- The provider-assigned unique ID for this managed resource.
- identities
Get
Server Identity[] - An
identityblock as defined below. - infrastructure
Encryption booleanEnabled - Whether or not infrastructure is encrypted for this MySQL Server.
- location string
- The Azure location where the resource exists.
- name string
- public
Network booleanAccess Enabled - Whether or not public network access is allowed for this MySQL Server.
- resource
Group stringName - restore
Point stringIn Time - sku
Name string - The SKU Name for this MySQL Server.
- ssl
Enforcement booleanEnabled - Specifies if SSL should be enforced on connections for this MySQL Server.
- ssl
Minimal stringTls Version Enforced - The minimum TLS version to support for this MySQL Server.
- storage
Mb number - Max storage allowed for this MySQL Server.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- threat
Detection GetPolicies Server Threat Detection Policy[] - Threat detection policy configuration, known in the API as Server Security Alerts Policy. The
threat_detection_policyblock exports fields documented below. - version string
- The version of this MySQL Server.
- administrator_
login str - The Administrator login for the MySQL Server.
- auto_
grow_ boolenabled - The auto grow setting for this MySQL Server.
- backup_
retention_ intdays - The backup retention days for this MySQL server.
- fqdn str
- The FQDN of the MySQL Server.
- geo_
redundant_ boolbackup_ enabled - The geo redundant backup setting for this MySQL Server.
- id str
- The provider-assigned unique ID for this managed resource.
- identities
Sequence[Get
Server Identity] - An
identityblock as defined below. - infrastructure_
encryption_ boolenabled - Whether or not infrastructure is encrypted for this MySQL Server.
- location str
- The Azure location where the resource exists.
- name str
- public_
network_ boolaccess_ enabled - Whether or not public network access is allowed for this MySQL Server.
- resource_
group_ strname - restore_
point_ strin_ time - sku_
name str - The SKU Name for this MySQL Server.
- ssl_
enforcement_ boolenabled - Specifies if SSL should be enforced on connections for this MySQL Server.
- ssl_
minimal_ strtls_ version_ enforced - The minimum TLS version to support for this MySQL Server.
- storage_
mb int - Max storage allowed for this MySQL Server.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- threat_
detection_ Sequence[Getpolicies Server Threat Detection Policy] - Threat detection policy configuration, known in the API as Server Security Alerts Policy. The
threat_detection_policyblock exports fields documented below. - version str
- The version of this MySQL Server.
- administrator
Login String - The Administrator login for the MySQL Server.
- auto
Grow BooleanEnabled - The auto grow setting for this MySQL Server.
- backup
Retention NumberDays - The backup retention days for this MySQL server.
- fqdn String
- The FQDN of the MySQL Server.
- geo
Redundant BooleanBackup Enabled - The geo redundant backup setting for this MySQL Server.
- id String
- The provider-assigned unique ID for this managed resource.
- identities List<Property Map>
- An
identityblock as defined below. - infrastructure
Encryption BooleanEnabled - Whether or not infrastructure is encrypted for this MySQL Server.
- location String
- The Azure location where the resource exists.
- name String
- public
Network BooleanAccess Enabled - Whether or not public network access is allowed for this MySQL Server.
- resource
Group StringName - restore
Point StringIn Time - sku
Name String - The SKU Name for this MySQL Server.
- ssl
Enforcement BooleanEnabled - Specifies if SSL should be enforced on connections for this MySQL Server.
- ssl
Minimal StringTls Version Enforced - The minimum TLS version to support for this MySQL Server.
- storage
Mb Number - Max storage allowed for this MySQL Server.
- Map<String>
- A mapping of tags to assign to the resource.
- threat
Detection List<Property Map>Policies - Threat detection policy configuration, known in the API as Server Security Alerts Policy. The
threat_detection_policyblock exports fields documented below. - version String
- The version of this MySQL Server.
Supporting Types
GetServerIdentity
- Principal
Id string - The Principal ID associated with this Managed Service Identity.
- Tenant
Id string - The Tenant ID associated with this Managed Service Identity.
- Type string
- The identity type of this Managed Service Identity.
- Principal
Id string - The Principal ID associated with this Managed Service Identity.
- Tenant
Id string - The Tenant ID associated with this Managed Service Identity.
- Type string
- The identity type of this Managed Service Identity.
- principal
Id String - The Principal ID associated with this Managed Service Identity.
- tenant
Id String - The Tenant ID associated with this Managed Service Identity.
- type String
- The identity type of this Managed Service Identity.
- principal
Id string - The Principal ID associated with this Managed Service Identity.
- tenant
Id string - The Tenant ID associated with this Managed Service Identity.
- type string
- The identity type of this Managed Service Identity.
- principal_
id str - The Principal ID associated with this Managed Service Identity.
- tenant_
id str - The Tenant ID associated with this Managed Service Identity.
- type str
- The identity type of this Managed Service Identity.
- principal
Id String - The Principal ID associated with this Managed Service Identity.
- tenant
Id String - The Tenant ID associated with this Managed Service Identity.
- type String
- The identity type of this Managed Service Identity.
GetServerThreatDetectionPolicy
- Disabled
Alerts List<string> - Specifies a list of alerts which should be disabled. Possible values include
Access_Anomaly,Sql_InjectionandSql_Injection_Vulnerability. - Email
Account boolAdmins - Should the account administrators be emailed when this alert is triggered?
- Email
Addresses List<string> - A list of email addresses which alerts should be sent to.
- Enabled bool
- Is the policy enabled?
- Retention
Days int - Specifies the number of days to keep in the Threat Detection audit logs.
- Storage
Account stringAccess Key - Specifies the identifier key of the Threat Detection audit storage account.
- Storage
Endpoint string - Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
- Disabled
Alerts []string - Specifies a list of alerts which should be disabled. Possible values include
Access_Anomaly,Sql_InjectionandSql_Injection_Vulnerability. - Email
Account boolAdmins - Should the account administrators be emailed when this alert is triggered?
- Email
Addresses []string - A list of email addresses which alerts should be sent to.
- Enabled bool
- Is the policy enabled?
- Retention
Days int - Specifies the number of days to keep in the Threat Detection audit logs.
- Storage
Account stringAccess Key - Specifies the identifier key of the Threat Detection audit storage account.
- Storage
Endpoint string - Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
- disabled
Alerts List<String> - Specifies a list of alerts which should be disabled. Possible values include
Access_Anomaly,Sql_InjectionandSql_Injection_Vulnerability. - email
Account BooleanAdmins - Should the account administrators be emailed when this alert is triggered?
- email
Addresses List<String> - A list of email addresses which alerts should be sent to.
- enabled Boolean
- Is the policy enabled?
- retention
Days Integer - Specifies the number of days to keep in the Threat Detection audit logs.
- storage
Account StringAccess Key - Specifies the identifier key of the Threat Detection audit storage account.
- storage
Endpoint String - Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
- disabled
Alerts string[] - Specifies a list of alerts which should be disabled. Possible values include
Access_Anomaly,Sql_InjectionandSql_Injection_Vulnerability. - email
Account booleanAdmins - Should the account administrators be emailed when this alert is triggered?
- email
Addresses string[] - A list of email addresses which alerts should be sent to.
- enabled boolean
- Is the policy enabled?
- retention
Days number - Specifies the number of days to keep in the Threat Detection audit logs.
- storage
Account stringAccess Key - Specifies the identifier key of the Threat Detection audit storage account.
- storage
Endpoint string - Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
- disabled_
alerts Sequence[str] - Specifies a list of alerts which should be disabled. Possible values include
Access_Anomaly,Sql_InjectionandSql_Injection_Vulnerability. - email_
account_ booladmins - Should the account administrators be emailed when this alert is triggered?
- email_
addresses Sequence[str] - A list of email addresses which alerts should be sent to.
- enabled bool
- Is the policy enabled?
- retention_
days int - Specifies the number of days to keep in the Threat Detection audit logs.
- storage_
account_ straccess_ key - Specifies the identifier key of the Threat Detection audit storage account.
- storage_
endpoint str - Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
- disabled
Alerts List<String> - Specifies a list of alerts which should be disabled. Possible values include
Access_Anomaly,Sql_InjectionandSql_Injection_Vulnerability. - email
Account BooleanAdmins - Should the account administrators be emailed when this alert is triggered?
- email
Addresses List<String> - A list of email addresses which alerts should be sent to.
- enabled Boolean
- Is the policy enabled?
- retention
Days Number - Specifies the number of days to keep in the Threat Detection audit logs.
- storage
Account StringAccess Key - Specifies the identifier key of the Threat Detection audit storage account.
- storage
Endpoint String - Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
