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

We recommend using Azure Native.

Azure Classic v5.84.0 published on Tuesday, Jul 16, 2024 by Pulumi

azure.mysql.getServer

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.84.0 published on Tuesday, Jul 16, 2024 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.Server data source is deprecated and will be removed in v4.0 of the AzureRM Provider. Please use the azure.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)
    
    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)
    // Output-based functions aren't available in Java yet
    
    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 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 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 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 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 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 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 Principal ID associated with this Managed Service Identity.
    TenantId string
    The Tenant ID associated with this Managed Service Identity.
    Type string
    The identity type of this Managed Service Identity.
    PrincipalId string
    The Principal ID associated with this Managed Service Identity.
    TenantId string
    The Tenant ID associated with this Managed Service Identity.
    Type string
    The identity type of this Managed Service Identity.
    principalId String
    The Principal ID associated with this Managed Service Identity.
    tenantId String
    The Tenant ID associated with this Managed Service Identity.
    type String
    The identity type of this Managed Service Identity.
    principalId string
    The Principal ID associated with this Managed Service Identity.
    tenantId 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.
    principalId String
    The Principal ID associated with this Managed Service Identity.
    tenantId String
    The Tenant ID associated with this Managed Service Identity.
    type String
    The identity type of this Managed Service Identity.

    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://example.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://example.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://example.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://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_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://example.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://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 azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.84.0 published on Tuesday, Jul 16, 2024 by Pulumi