1. Packages
  2. Packages
  3. Azure Classic
  4. API Docs
  5. mysql
  6. getServer

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Use this data source to access information about an existing MySQL Server.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var example = Output.Create(Azure.MySql.GetServer.InvokeAsync(new Azure.MySql.GetServerArgs
            {
                Name = "existingMySqlServer",
                ResourceGroupName = "existingResGroup",
            }));
            this.Id = example.Apply(example => example.Id);
        }
    
        [Output("id")]
        public Output<string> Id { get; set; }
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/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
    	})
    }
    

    Example coming soon!

    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)
    

    Example coming soon!

    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 dictionary

    The following arguments are supported:

    Name string
    Specifies the name of the MySQL Server.
    ResourceGroupName string
    The name of the resource group for the MySQL Server.
    Name string
    Specifies the name of the MySQL Server.
    ResourceGroupName string
    The name of the resource group for the MySQL Server.
    name String
    Specifies the name of the MySQL Server.
    resourceGroupName String
    The name of the resource group for the MySQL Server.
    name string
    Specifies the name of the MySQL Server.
    resourceGroupName string
    The name of the resource group for the MySQL Server.
    name str
    Specifies the name of the MySQL Server.
    resource_group_name str
    The name of the resource group for the MySQL Server.
    name String
    Specifies the name of the MySQL Server.
    resourceGroupName String
    The name of the resource group for the MySQL Server.

    getServer Result

    The following output properties are available:

    AdministratorLogin string
    The Administrator Login for the MySQL Server.
    AutoGrowEnabled bool
    The auto grow setting for this MySQL Server.
    BackupRetentionDays int
    The backup retention days for this MySQL server.
    Fqdn string
    The FQDN of the MySQL Server.
    GeoRedundantBackupEnabled bool
    The geo redundant backup setting for this MySQL Server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identities List<GetServerIdentity>
    An identity block for this MySQL server as defined below.
    InfrastructureEncryptionEnabled bool
    Whether or not infrastructure is encrypted for this MySQL Server.
    Location string
    The Azure location where the resource exists.
    Name string
    PublicNetworkAccessEnabled bool
    Whether or not public network access is allowed for this MySQL Server.
    ResourceGroupName string
    RestorePointInTime string
    SkuName string
    The SKU Name for this MySQL Server.
    SslEnforcementEnabled bool
    Specifies if SSL should be enforced on connections for this MySQL Server.
    SslMinimalTlsVersionEnforced string
    The minimum TLS version to support for this MySQL Server.
    StorageMb int
    Max storage allowed for this MySQL Server.
    Tags Dictionary<string, string>

    A mapping of tags to assign to the resource.

    ThreatDetectionPolicies List<GetServerThreatDetectionPolicy>
    Threat detection policy configuration, known in the API as Server Security Alerts Policy. The threat_detection_policy block exports fields documented below.
    Version string
    The version of this MySQL Server.
    AdministratorLogin string
    The Administrator Login for the MySQL Server.
    AutoGrowEnabled bool
    The auto grow setting for this MySQL Server.
    BackupRetentionDays int
    The backup retention days for this MySQL server.
    Fqdn string
    The FQDN of the MySQL Server.
    GeoRedundantBackupEnabled bool
    The geo redundant backup setting for this MySQL Server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identities []GetServerIdentity
    An identity block for this MySQL server as defined below.
    InfrastructureEncryptionEnabled bool
    Whether or not infrastructure is encrypted for this MySQL Server.
    Location string
    The Azure location where the resource exists.
    Name string
    PublicNetworkAccessEnabled bool
    Whether or not public network access is allowed for this MySQL Server.
    ResourceGroupName string
    RestorePointInTime string
    SkuName string
    The SKU Name for this MySQL Server.
    SslEnforcementEnabled bool
    Specifies if SSL should be enforced on connections for this MySQL Server.
    SslMinimalTlsVersionEnforced string
    The minimum TLS version to support for this MySQL Server.
    StorageMb int
    Max storage allowed for this MySQL Server.
    Tags map[string]string

    A mapping of tags to assign to the resource.

    ThreatDetectionPolicies []GetServerThreatDetectionPolicy
    Threat detection policy configuration, known in the API as Server Security Alerts Policy. The threat_detection_policy block exports fields documented below.
    Version string
    The version of this MySQL Server.
    administratorLogin String
    The Administrator Login for the MySQL Server.
    autoGrowEnabled Boolean
    The auto grow setting for this MySQL Server.
    backupRetentionDays Integer
    The backup retention days for this MySQL server.
    fqdn String
    The FQDN of the MySQL Server.
    geoRedundantBackupEnabled Boolean
    The geo redundant backup setting for this MySQL Server.
    id String
    The provider-assigned unique ID for this managed resource.
    identities List<GetServerIdentity>
    An identity block for this MySQL server as defined below.
    infrastructureEncryptionEnabled Boolean
    Whether or not infrastructure is encrypted for this MySQL Server.
    location String
    The Azure location where the resource exists.
    name String
    publicNetworkAccessEnabled Boolean
    Whether or not public network access is allowed for this MySQL Server.
    resourceGroupName String
    restorePointInTime String
    skuName String
    The SKU Name for this MySQL Server.
    sslEnforcementEnabled Boolean
    Specifies if SSL should be enforced on connections for this MySQL Server.
    sslMinimalTlsVersionEnforced String
    The minimum TLS version to support for this MySQL Server.
    storageMb Integer
    Max storage allowed for this MySQL Server.
    tags Map<String,String>

    A mapping of tags to assign to the resource.

    threatDetectionPolicies List<GetServerThreatDetectionPolicy>
    Threat detection policy configuration, known in the API as Server Security Alerts Policy. The threat_detection_policy block exports fields documented below.
    version String
    The version of this MySQL Server.
    administratorLogin string
    The Administrator Login for the MySQL Server.
    autoGrowEnabled boolean
    The auto grow setting for this MySQL Server.
    backupRetentionDays number
    The backup retention days for this MySQL server.
    fqdn string
    The FQDN of the MySQL Server.
    geoRedundantBackupEnabled boolean
    The geo redundant backup setting for this MySQL Server.
    id string
    The provider-assigned unique ID for this managed resource.
    identities GetServerIdentity[]
    An identity block for this MySQL server as defined below.
    infrastructureEncryptionEnabled boolean
    Whether or not infrastructure is encrypted for this MySQL Server.
    location string
    The Azure location where the resource exists.
    name string
    publicNetworkAccessEnabled boolean
    Whether or not public network access is allowed for this MySQL Server.
    resourceGroupName string
    restorePointInTime string
    skuName string
    The SKU Name for this MySQL Server.
    sslEnforcementEnabled boolean
    Specifies if SSL should be enforced on connections for this MySQL Server.
    sslMinimalTlsVersionEnforced string
    The minimum TLS version to support for this MySQL Server.
    storageMb number
    Max storage allowed for this MySQL Server.
    tags {[key: string]: string}

    A mapping of tags to assign to the resource.

    threatDetectionPolicies GetServerThreatDetectionPolicy[]
    Threat detection policy configuration, known in the API as Server Security Alerts Policy. The threat_detection_policy block exports fields documented below.
    version string
    The version of this MySQL Server.
    administrator_login str
    The Administrator Login for the MySQL Server.
    auto_grow_enabled bool
    The auto grow setting for this MySQL Server.
    backup_retention_days int
    The backup retention days for this MySQL server.
    fqdn str
    The FQDN of the MySQL Server.
    geo_redundant_backup_enabled bool
    The geo redundant backup setting for this MySQL Server.
    id str
    The provider-assigned unique ID for this managed resource.
    identities Sequence[GetServerIdentity]
    An identity block for this MySQL server as defined below.
    infrastructure_encryption_enabled bool
    Whether or not infrastructure is encrypted for this MySQL Server.
    location str
    The Azure location where the resource exists.
    name str
    public_network_access_enabled bool
    Whether or not public network access is allowed for this MySQL Server.
    resource_group_name str
    restore_point_in_time str
    sku_name str
    The SKU Name for this MySQL Server.
    ssl_enforcement_enabled bool
    Specifies if SSL should be enforced on connections for this MySQL Server.
    ssl_minimal_tls_version_enforced str
    The minimum TLS version to support for this MySQL Server.
    storage_mb int
    Max storage allowed for this MySQL Server.
    tags Mapping[str, str]

    A mapping of tags to assign to the resource.

    threat_detection_policies Sequence[GetServerThreatDetectionPolicy]
    Threat detection policy configuration, known in the API as Server Security Alerts Policy. The threat_detection_policy block exports fields documented below.
    version str
    The version of this MySQL Server.
    administratorLogin String
    The Administrator Login for the MySQL Server.
    autoGrowEnabled Boolean
    The auto grow setting for this MySQL Server.
    backupRetentionDays Number
    The backup retention days for this MySQL server.
    fqdn String
    The FQDN of the MySQL Server.
    geoRedundantBackupEnabled Boolean
    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 identity block for this MySQL server as defined below.
    infrastructureEncryptionEnabled Boolean
    Whether or not infrastructure is encrypted for this MySQL Server.
    location String
    The Azure location where the resource exists.
    name String
    publicNetworkAccessEnabled Boolean
    Whether or not public network access is allowed for this MySQL Server.
    resourceGroupName String
    restorePointInTime String
    skuName String
    The SKU Name for this MySQL Server.
    sslEnforcementEnabled Boolean
    Specifies if SSL should be enforced on connections for this MySQL Server.
    sslMinimalTlsVersionEnforced String
    The minimum TLS version to support for this MySQL Server.
    storageMb Number
    Max storage allowed for this MySQL Server.
    tags Map<String>

    A mapping of tags to assign to the resource.

    threatDetectionPolicies List<Property Map>
    Threat detection policy configuration, known in the API as Server Security Alerts Policy. The threat_detection_policy block exports fields documented below.
    version String
    The version of this MySQL Server.

    Supporting Types

    GetServerIdentity

    PrincipalId string
    The Client ID of the Service Principal assigned to this MySQL Server.
    TenantId string

    The ID of the Tenant the Service Principal is assigned in.

    Type string
    The Type of Identity used for this MySQL Server.
    PrincipalId string
    The Client ID of the Service Principal assigned to this MySQL Server.
    TenantId string

    The ID of the Tenant the Service Principal is assigned in.

    Type string
    The Type of Identity used for this MySQL Server.
    principalId String
    The Client ID of the Service Principal assigned to this MySQL Server.
    tenantId String

    The ID of the Tenant the Service Principal is assigned in.

    type String
    The Type of Identity used for this MySQL Server.
    principalId string
    The Client ID of the Service Principal assigned to this MySQL Server.
    tenantId string

    The ID of the Tenant the Service Principal is assigned in.

    type string
    The Type of Identity used for this MySQL Server.
    principal_id str
    The Client ID of the Service Principal assigned to this MySQL Server.
    tenant_id str

    The ID of the Tenant the Service Principal is assigned in.

    type str
    The Type of Identity used for this MySQL Server.
    principalId String
    The Client ID of the Service Principal assigned to this MySQL Server.
    tenantId String

    The ID of the Tenant the Service Principal is assigned in.

    type String
    The Type of Identity used for this MySQL Server.

    GetServerThreatDetectionPolicy

    DisabledAlerts List<string>
    Specifies a list of alerts which should be disabled. Possible values include Access_Anomaly, Sql_Injection and Sql_Injection_Vulnerability.
    EmailAccountAdmins bool
    Should the account administrators be emailed when this alert is triggered?
    EmailAddresses List<string>
    A list of email addresses which alerts should be sent to.
    Enabled bool
    Is the policy enabled?
    RetentionDays int
    Specifies the number of days to keep in the Threat Detection audit logs.
    StorageAccountAccessKey string
    Specifies the identifier key of the Threat Detection audit storage account.
    StorageEndpoint string
    Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
    DisabledAlerts []string
    Specifies a list of alerts which should be disabled. Possible values include Access_Anomaly, Sql_Injection and Sql_Injection_Vulnerability.
    EmailAccountAdmins bool
    Should the account administrators be emailed when this alert is triggered?
    EmailAddresses []string
    A list of email addresses which alerts should be sent to.
    Enabled bool
    Is the policy enabled?
    RetentionDays int
    Specifies the number of days to keep in the Threat Detection audit logs.
    StorageAccountAccessKey string
    Specifies the identifier key of the Threat Detection audit storage account.
    StorageEndpoint string
    Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
    disabledAlerts List<String>
    Specifies a list of alerts which should be disabled. Possible values include Access_Anomaly, Sql_Injection and Sql_Injection_Vulnerability.
    emailAccountAdmins Boolean
    Should the account administrators be emailed when this alert is triggered?
    emailAddresses List<String>
    A list of email addresses which alerts should be sent to.
    enabled Boolean
    Is the policy enabled?
    retentionDays Integer
    Specifies the number of days to keep in the Threat Detection audit logs.
    storageAccountAccessKey String
    Specifies the identifier key of the Threat Detection audit storage account.
    storageEndpoint String
    Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
    disabledAlerts string[]
    Specifies a list of alerts which should be disabled. Possible values include Access_Anomaly, Sql_Injection and Sql_Injection_Vulnerability.
    emailAccountAdmins boolean
    Should the account administrators be emailed when this alert is triggered?
    emailAddresses string[]
    A list of email addresses which alerts should be sent to.
    enabled boolean
    Is the policy enabled?
    retentionDays number
    Specifies the number of days to keep in the Threat Detection audit logs.
    storageAccountAccessKey string
    Specifies the identifier key of the Threat Detection audit storage account.
    storageEndpoint string
    Specifies the blob storage endpoint (e.g. https://MyAccount.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_Injection and Sql_Injection_Vulnerability.
    email_account_admins bool
    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_access_key str
    Specifies the identifier key of the Threat Detection audit storage account.
    storage_endpoint str
    Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
    disabledAlerts List<String>
    Specifies a list of alerts which should be disabled. Possible values include Access_Anomaly, Sql_Injection and Sql_Injection_Vulnerability.
    emailAccountAdmins Boolean
    Should the account administrators be emailed when this alert is triggered?
    emailAddresses List<String>
    A list of email addresses which alerts should be sent to.
    enabled Boolean
    Is the policy enabled?
    retentionDays Number
    Specifies the number of days to keep in the Threat Detection audit logs.
    storageAccountAccessKey String
    Specifies the identifier key of the Threat Detection audit storage account.
    storageEndpoint String
    Specifies the blob storage endpoint (e.g. https://MyAccount.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 azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.