New-AzSqlServer
Creates a SQL Database server.
Syntax
Default (Default)
New-AzSqlServer
-ServerName <String>
[-SqlAdministratorCredentials <PSCredential>]
-Location <String>
[-Tags <Hashtable>]
[-ServerVersion <String>]
[-AssignIdentity]
[-PublicNetworkAccess <String>]
[-RestrictOutboundNetworkAccess <String>]
[-MinimalTlsVersion <String>]
[-PrimaryUserAssignedIdentityId <String>]
[-KeyId <String>]
[-UserAssignedIdentityId <System.Collections.Generic.List`1[System.String]>]
[-IdentityType <String>]
[-AsJob]
[-EnableActiveDirectoryOnlyAuthentication]
[-ExternalAdminName <String>]
[-ExternalAdminSID <Guid>]
[-FederatedClientId <Guid>]
[-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzSqlServer cmdlet creates an Azure SQL Database server.
Examples
Example 1: Create a new Azure SQL Database server
New-AzSqlServer -ResourceGroupName "ResourceGroup01" -Location "Central US" -ServerName "server01" -ServerVersion "12.0" -SqlAdministratorCredentials (Get-Credential)
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
This command creates a version 12 Azure SQL Database server.
Example 2: Create a new Azure SQL Database server with External (Microsoft Entra ID) Administrator, Microsoft Entra-only Authentication and no SqlAdministratorCredentials
New-AzSqlServer -ResourceGroupName "ResourceGroup01" -Location "Central US" -ServerName "server01" -ServerVersion "12.0" -ExternalAdminName DummyLogin -EnableActiveDirectoryOnlyAuthentication
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Administrators :
$val = Get-AzSqlServer -ResourceGroupName "ResourceGroup01" -ServerName "server01" -ExpandActiveDirectoryAdministrator
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : randomLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Administrators : Microsoft.Azure.Management.Sql.Models.ServerExternalAdministrator
$val.Administrators
AdministratorType : ActiveDirectory
PrincipalType : Group
Login : DummyLogin
Sid : df7667b8-f9fd-4029-a0e3-b43c75ce9538
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
AzureADOnlyAuthentication : True
This command creates a version 12 Azure SQL Database server with external administrator properties and Microsoft Entra-only authentication enabled.
Example 3: Create a new Azure SQL Database server with TDE CMK
New-AzSqlServer -ResourceGroupName "ResourceGroup01" -Location "East US" -ServerName "server01" -ServerVersion "12.0" -SqlAdministratorCredentials (Get-Credential) -AssignIdentity -IdentityType "UserAssigned" -PrimaryUserAssignedIdentityId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity01" -UserAssignedIdentityId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity01" -KeyId "https://contoso.vault.azure.net/keys/contosokey/01234567890123456789012345678901"
ResourceGroupName : resourcegroup01
ServerName : server01
Location : East US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
KeyId : https://contoso.vault.azure.net/keys/contosokey/01234567890123456789012345678901
PrimaryUserAssignedIdentityId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity01
This command creates a version 12 Azure SQL Database server with TDE CMK enabled.
Parameters
-AsJob
Run cmdlet in the background
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-AssignIdentity
Generate and assign a Microsoft Entra identity for this server for use with key management services like Azure KeyVault.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EnableActiveDirectoryOnlyAuthentication
Enable Active Directory Only Authentication on the server.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ExternalAdminName
Specifies the display name of the user, group or application which is the Microsoft Entra administrator for the server. This display name must exist in the active directory associated with the current subscription.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ExternalAdminSID
Specifies the object ID of the user, group or application which is the Microsoft Entra administrator.
Parameter properties
Type: Nullable<T> [ Guid ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-FederatedClientId
Specifies the Federated client ID of the server when using Cross-Tenant CMK, Do not set this value if you do not intent to use Cross-Tenant CMK
Parameter properties
Type: Nullable<T> [ Guid ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-IdentityType
Type of identity to be assigned to the server. Possible values are SystemAssigned, UserAssigned, 'SystemAssigned,UserAssigned' and None.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-KeyId
The Azure Key Vault URI that is used for encryption.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Location
Specifies the location of the data center where this cmdlet creates the server.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-MinimalTlsVersion
The minimal TLS version to enforce for Sql Server
Parameter properties
Type: String
Default value: 1.2
Accepted values: None, 1.0, 1.1, 1.2
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PrimaryUserAssignedIdentityId
The primary User Managed Identity(UMI) id.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PublicNetworkAccess
Takes a flag, enabled/disabled, to specify whether public network access to server is allowed or not.
When disabled, only connections made through Private Links can reach this server.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of the resource group to which this cmdlet assigns the server.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-RestrictOutboundNetworkAccess
When enabled, only outbound connections allowed by the outbound firewall rules will succeed.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ServerName
Specifies the name of the new server.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Name
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ServerVersion
Specifies the version of the new server. The acceptable values for this parameter are: 2.0 and 12.0.
Specify 2.0 to create a version 11 server, or 12.0 to create a version 12 server.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SqlAdministratorCredentials
Specifies the SQL Database server administrator credentials for the new server. To obtain a
PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential
.
Parameter properties
Type: PSCredential
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
Key-value pairs in the form of a hash table. For example:
@{key0="value0";key1=$null;key2="value2"}
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Tag
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-UserAssignedIdentityId
The list of user assigned identities.
Parameter properties
Type: List<T> [ String ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs