New-AzSqlServer

Creates a SQL Database server.

Syntax

New-AzSqlServer
   -ServerName <String>
   [-SqlAdministratorCredentials <PSCredential>]
   -Location <String>
   [-Tags <Hashtable>]
   [-ServerVersion <String>]
   [-AssignIdentity]
   [-PublicNetworkAccess <String>]
   [-MinimalTlsVersion <String>]
   [-AsJob]
   [-EnableActiveDirectoryOnlyAuthentication]
   [-ExternalAdminName <String>]
   [-ExternalAdminSID <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

PS C:\>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(Azure Active Directory) Administrator, Azure Active Directory Only Authentication and no SqlAdministratorCredentials

PS C:\>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           :

PS C:\>$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

PS C:\>$val.Administrators
AdministratorType         : ActiveDirectory
PrincipalType             : Group
Login                     : DummyLogin
Sid                       : df7667b8-f9fd-4029-a0e3-b43c75ce9538
TenantId                  : f553829b-6d84-481b-86a9-42db57c1dc73
AzureADOnlyAuthentication : True

This command creates a version 12 Azure SQL Database server with external administrator properties and azure active directory only authentication enabled.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-AssignIdentity

Generate and assign an Azure Active Directory Identity for this server for use with key management services like Azure KeyVault.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnableActiveDirectoryOnlyAuthentication

Enable Active Directory Only Authentication on the server.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ExternalAdminName

Specifies the display name of the user, group or application which is the Azure Active Directory administrator for the server. This display name must exist in the active directory associated with the current subscription.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ExternalAdminSID

Specifies the object ID of the user, group or application which is the Azure Active Directory administrator.

Type:Nullable<T>[Guid]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IdentityType

Type of identity to be assigned to the server. Possible values are SystemAsssigned, UserAssigned, SystemAssignedUserAssigned and None.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-KeyId

The Azure Key Vault URI that is used for encryption.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Location

Specifies the location of the data center where this cmdlet creates the server.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MinimalTlsVersion

The minimal TLS version to enforce for Sql Server

Type:String
Accepted values:1.0, 1.1, 1.2
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PrimaryUserAssignedIdentityId

The primary User Managed Identity(UMI) id.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group to which this cmdlet assigns the server.

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ServerName

Specifies the name of the new server.

Type:String
Aliases:Name
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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.

Type:PSCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Tags

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

Type:Hashtable
Aliases:Tag
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UserAssignedIdentityId

The list of user assigned identities.

Type:System.Collections.Generic.List
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

AzureSqlServerModel