你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzSqlInstance

创建Azure SQL 托管实例。

语法

New-AzSqlInstance
   [-Name] <String>
   [-ResourceGroupName] <String>
   [-AdministratorCredential <PSCredential>]
   -Location <String>
   -SubnetId <String>
   [-LicenseType <String>]
   [-StorageSizeInGB <Int32>]
   [-StorageIOps <Int32>]
   -VCore <Int32>
   -Edition <String>
   -ComputeGeneration <String>
   [-IsGeneralPurposeV2 <Boolean>]
   [-Collation <String>]
   [-PublicDataEndpointEnabled]
   [-ProxyOverride <String>]
   [-TimezoneId <String>]
   [-Tag <Hashtable>]
   [-AssignIdentity]
   [-DnsZonePartner <String>]
   [-InstancePoolName <String>]
   [-MinimalTlsVersion <String>]
   [-BackupStorageRedundancy <String>]
   [-MaintenanceConfigurationId <String>]
   [-PrimaryUserAssignedIdentityId <String>]
   [-KeyId <String>]
   [-UserAssignedIdentityId <System.Collections.Generic.List`1[System.String]>]
   [-IdentityType <String>]
   [-AsJob]
   [-Force]
   [-EnableActiveDirectoryOnlyAuthentication]
   [-ExternalAdminName <String>]
   [-ExternalAdminSID <Guid>]
   [-ZoneRedundant]
   [-ServicePrincipalType <String>]
   [-DatabaseFormat <String>]
   [-PricingModel <String>]
   [-AuthenticationMetadata <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzSqlInstance
   [-InstancePool] <AzureSqlInstancePoolModel>
   [-Name] <String>
   [-AdministratorCredential <PSCredential>]
   [-StorageSizeInGB <Int32>]
   -VCore <Int32>
   [-Collation <String>]
   [-PublicDataEndpointEnabled]
   [-ProxyOverride <String>]
   [-TimezoneId <String>]
   [-Tag <Hashtable>]
   [-AssignIdentity]
   [-DnsZonePartner <String>]
   [-MinimalTlsVersion <String>]
   [-BackupStorageRedundancy <String>]
   [-MaintenanceConfigurationId <String>]
   [-PrimaryUserAssignedIdentityId <String>]
   [-KeyId <String>]
   [-UserAssignedIdentityId <System.Collections.Generic.List`1[System.String]>]
   [-IdentityType <String>]
   [-AsJob]
   [-Force]
   [-EnableActiveDirectoryOnlyAuthentication]
   [-ExternalAdminName <String>]
   [-ExternalAdminSID <Guid>]
   [-ZoneRedundant]
   [-ServicePrincipalType <String>]
   [-DatabaseFormat <String>]
   [-PricingModel <String>]
   [-AuthenticationMetadata <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzSqlInstance
   [-InstancePoolResourceId] <String>
   [-Name] <String>
   [-AdministratorCredential <PSCredential>]
   [-StorageSizeInGB <Int32>]
   -VCore <Int32>
   [-Collation <String>]
   [-PublicDataEndpointEnabled]
   [-ProxyOverride <String>]
   [-TimezoneId <String>]
   [-Tag <Hashtable>]
   [-AssignIdentity]
   [-DnsZonePartner <String>]
   [-MinimalTlsVersion <String>]
   [-BackupStorageRedundancy <String>]
   [-MaintenanceConfigurationId <String>]
   [-PrimaryUserAssignedIdentityId <String>]
   [-KeyId <String>]
   [-UserAssignedIdentityId <System.Collections.Generic.List`1[System.String]>]
   [-IdentityType <String>]
   [-AsJob]
   [-Force]
   [-EnableActiveDirectoryOnlyAuthentication]
   [-ExternalAdminName <String>]
   [-ExternalAdminSID <Guid>]
   [-ZoneRedundant]
   [-ServicePrincipalType <String>]
   [-DatabaseFormat <String>]
   [-PricingModel <String>]
   [-AuthenticationMetadata <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzSqlInstance
   [-Name] <String>
   [-ResourceGroupName] <String>
   [-AdministratorCredential <PSCredential>]
   -Location <String>
   -SubnetId <String>
   [-LicenseType <String>]
   [-StorageSizeInGB <Int32>]
   [-StorageIOps <Int32>]
   -VCore <Int32>
   -SkuName <String>
   [-IsGeneralPurposeV2 <Boolean>]
   [-Collation <String>]
   [-PublicDataEndpointEnabled]
   [-ProxyOverride <String>]
   [-TimezoneId <String>]
   [-Tag <Hashtable>]
   [-AssignIdentity]
   [-DnsZonePartner <String>]
   [-InstancePoolName <String>]
   [-MinimalTlsVersion <String>]
   [-BackupStorageRedundancy <String>]
   [-MaintenanceConfigurationId <String>]
   [-PrimaryUserAssignedIdentityId <String>]
   [-KeyId <String>]
   [-UserAssignedIdentityId <System.Collections.Generic.List`1[System.String]>]
   [-IdentityType <String>]
   [-AsJob]
   [-Force]
   [-EnableActiveDirectoryOnlyAuthentication]
   [-ExternalAdminName <String>]
   [-ExternalAdminSID <Guid>]
   [-ZoneRedundant]
   [-ServicePrincipalType <String>]
   [-DatabaseFormat <String>]
   [-PricingModel <String>]
   [-AuthenticationMetadata <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

说明

New-AzSqlInstance cmdlet 创建 Azure SQL 托管实例。

示例

示例 1:创建新实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName ResourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -SkuName GP_Gen4 -DnsZonePartner "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/partnerServerForDnsZone"

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance1
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :

此命令使用 SkuName 参数创建新实例。

示例 2:创建新实例

New-AzSqlInstance -Name managedInstance2 -ResourceGroupName ResourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -Edition "GeneralPurpose" -ComputeGeneration Gen4

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance2
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :

此命令通过使用 Edition 和 ComputeGeneration 参数创建一个新实例。

示例 3:创建新的 GPv2 实例

New-AzSqlInstance -Name "managedInstance3" -ResourceGroupName "ResourceGroup01" -Location "westcentralus" -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType "LicenseIncluded" -StorageSizeInGB 1024 -StorageIOps 4000 -VCore 8 -SkuName "GP_Gen5" -IsGeneralPurposeV2 $true

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance3
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : true
FullyQualifiedDomainName : managedInstance3.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 8
StorageSizeInGB          : 1024
StorageIOps              : 4000
DnsZone                  : ad35cna0mw
InstancePoolName         :

此命令使用 SkuName 参数创建新的 GPv2 实例。

示例 4:创建新的 GPv2 实例

New-AzSqlInstance -Name "managedInstance4" -ResourceGroupName "ResourceGroup01" -Location "westcentralus" -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType "LicenseIncluded" -StorageSizeInGB 1024 -StorageIOps 4000 -VCore 8 -Edition "GeneralPurpose" -ComputeGeneration "Gen5" -IsGeneralPurposeV2 $true

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance4
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : true
FullyQualifiedDomainName : managedInstance4.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 8
StorageSizeInGB          : 1024
StorageIOps              : 4000
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :

此命令通过使用 Edition 和 ComputeGeneration 参数创建新的 GPv2 实例。

示例 5:使用实例池对象在实例池中创建新实例

$instancePool = Get-AzSqlInstancePool -ResourceGroupName resourcegroup01 -Name instancepool0
$instancePool | New-AzSqlInstance -Name managedInstance2 -AdministratorCredential (Get-Credential) -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 2

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance2
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 2
StorageSizeInGB          : 1024
DnsZone                  : ad35cna0mw
InstancePoolName         : instancepool0

此命令使用实例池对象在实例池中创建一个新实例。

示例 6:使用实例池资源标识符在实例池中创建新实例

New-AzSqlInstance -Name managedInstance2 -AdministratorCredential (Get-Credential) -StorageSizeInGB 1024 -VCore 2 -InstancePoolResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/instancePools/instancePool0"

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance2
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 2
StorageSizeInGB          : 1024
DnsZone                  : ad35cna0mw
InstancePoolName         : instancepool0

此命令使用实例池的资源标识符在实例池中创建一个新实例。

示例 7:在实例池中创建新实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName resourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 32 -VCore 2 -ComputeGeneration Gen5 -Edition GeneralPurpose -InstancePoolName instancePool0

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance1
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 2
StorageSizeInGB          : 32
DnsZone                  : ad35cna0mw
InstancePoolName         : instancePool0

此命令在名为 instancePool0 的实例池中创建一个新实例

示例 8:使用维护配置创建新实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName resourcegroup01 -Location "westus" -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -VCore 8 -ComputeGeneration Gen5 -Edition GeneralPurpose -MaintenanceConfigurationId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_WestUS_MI_2"

Location							: westus
Id									: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName					: resourcegroup01
ManagedInstanceName					: managedInstance1
Tags								:
Identity							:
Sku									: Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2					: false
FullyQualifiedDomainName			: managedInstance1.wusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin					: adminLogin1
AdministratorPassword				:
SubnetId							: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType							: LicenseIncluded
VCores								: 8
StorageSizeInGB						: 256
StorageIOps							:
Collation							: SQL_Latin1_General_CP1_CI_AS
PublicDataEndpointEnabled			: False
ProxyOverride						:
TimezoneId							: UTC
DnsZonePartner						:
DnsZone								: ad35cna0mw
InstancePoolName					:
MinimalTlsVersion					:
CurrentBackupStorageRedundancy		: Geo
RequestedBackupStorageRedundancy	: Geo
MaintenanceConfigurationId			: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_WestUS_MI_2

此命令创建具有维护配置的新实例MI_2

示例 9:使用外部(Microsoft Entra ID)管理员创建新实例,Microsoft仅限 Entra 的身份验证,并且没有 SqlAdministratorCredentials

New-AzSqlInstance -Name managedInstance2 -ResourceGroupName ResourceGroup01 -ExternalAdminName DummyLogin -EnableActiveDirectoryOnlyAuthentication -Location westcentralus -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -Edition "GeneralPurpose" -ComputeGeneration Gen4

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance2
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :
Administrators           :

$val = Get-AzSqlInstance -Name managedInstance2 -ResourceGroupName ResourceGroup01 -ExpandActiveDirectoryAdministrator
Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance2
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :
Administrators           : Microsoft.Azure.Management.Sql.Models.ManagedInstanceExternalAdministrator

$val.Administrators
AdministratorType         : ActiveDirectory
PrincipalType             : Group
Login                     : DummyLogin
Sid                       : df7667b8-f9fd-4029-a0e3-b43c75ce9538
TenantId                  : 00001111-aaaa-2222-bbbb-3333cccc4444
AzureADOnlyAuthentication : True

此命令将创建一个新实例,其中包含外部管理员属性并启用Microsoft仅限 Entra 的身份验证。

示例 10:创建新区域 - 冗余实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName ResourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -SkuName GP_Gen4 -DnsZonePartner "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/partnerServerForDnsZone" -ZoneRedundant

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance1
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :
ZoneRedundant            : true

此命令将创建新的区域 - 冗余实例。

示例 11:使用 TDE CMK 创建新实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName ResourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -SkuName GP_Gen4 -DnsZonePartner "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/partnerServerForDnsZone" -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"

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance1
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
InstancePoolName         :
KeyId                    : https://contoso.vault.azure.net/keys/contosokey/01234567890123456789012345678901
PrimaryUserAssignedIdentityId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity01

此命令创建启用了 TDE CMK 的新托管实例。

示例 12:使用数据库格式和定价模型创建新实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName ResourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -SkuName GP_Gen4 -DnsZonePartner "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/partnerServerForDnsZone" -DatabaseFormat AlwaysUpToDate -PricingModel Regular

Location                 : westcentralus
Id                       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName        : resourcegroup01
ManagedInstanceName      : managedInstance1
Tags                     :
Identity                 : Microsoft.Azure.Management.Sql.Models.ResourceIdentity
Sku                      : Microsoft.Azure.Management.Internal.Resources.Models.Sku
IsGeneralPurposeV2       : false
FullyQualifiedDomainName : managedInstance1.wcusxxxxxxxxxxxxx.database.windows.net
AdministratorLogin       : adminLogin1
AdministratorPassword    :
SubnetId                 : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType              : LicenseIncluded
VCores                   : 16
StorageSizeInGB          : 1024
StorageIOps              :
DnsZone                  : ad35cna0mw
DatabaseFormat           : AlwaysUpToDate
PricingModel             : Regular

此命令创建一个新实例,并指定了数据库格式和定价模型。

示例 10:创建使用Windows 身份验证元数据模式的新托管实例

New-AzSqlInstance -Name managedInstance1 -ResourceGroupName ResourceGroup01 -Location westcentralus -AdministratorCredential (Get-Credential) -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name" -LicenseType LicenseIncluded -StorageSizeInGB 1024 -VCore 16 -SkuName GP_Gen5 -AuthenticationMetadata Windows

Location                         : westcentralus
Id                               : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/managedInstance1
ResourceGroupName                : resourcegroup01
ManagedInstanceName              : managedInstance1
Tags                             :
Identity                         :
Sku                              : Microsoft.Azure.Management.Internal.Resources.Models.Sku
FullyQualifiedDomainName         : managedInstance1.xxxxxxxxxxxx.database.windows.net
AdministratorLogin               : adminLogin1
AdministratorPassword            :
SubnetId                         : subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name
LicenseType                      : LicenseIncluded
VCores                           : 16
StorageSizeInGB                  : 1024
Collation                        : SQL_Latin1_General_CP1_CI_AS
PublicDataEndpointEnabled        : False
ProxyOverride                    : Default
TimezoneId                       : UTC
DnsZonePartner                   :
DnsZone                          : ad35cna0mw
InstancePoolName                 :
MinimalTlsVersion                : None
BackupStorageRedundancy          : Geo
RequestedBackupStorageRedundancy : Geo
CurrentBackupStorageRedundancy   : Geo
MaintenanceConfigurationId       : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Maintenance/
                                   publicMaintenanceConfigurations/SQL_Default
Administrators                   :
PrimaryUserAssignedIdentityId    :
KeyId                            :
ZoneRedundant                    : False
ServicePrincipal                 :
DatabaseFormat                   : SQLServer2022
PricingModel                     : Regular
ExternalGovernanceStatus         : Disabled
AuthenticationMetadata           : Windows

此命令创建一个新的托管实例,该实例使用 Windows 元数据对同步用户进行身份验证。

参数

-AdministratorCredential

实例的 SQL 身份验证凭据。

类型:PSCredential
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-AsJob

在后台运行 cmdlet

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-AssignIdentity

为此托管实例生成并分配Microsoft Entra 标识,以用于 Azure KeyVault 等密钥管理服务。

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-AuthenticationMetadata

用于对已同步本地用户进行身份验证的首选元数据。 默认值为 AzureAD。

类型:String
接受的值:AzureAD, Paired, Windows
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-BackupStorageRedundancy

用于存储 Sql Azure 托管实例备份的备份存储冗余。 选项包括:本地、区域和地理位置

类型:String
接受的值:Local, Zone, Geo, GeoZone
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Collation

要使用的Azure SQL 托管实例的排序规则。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ComputeGeneration

实例的计算生成。

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-Confirm

提示你在运行 cmdlet 之前进行确认。

类型:SwitchParameter
别名:cf
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-DatabaseFormat

实例的数据库格式。 可能的值为:

  • AlwaysUpToDate - 实例在 Azure 中发布后立即访问所有新的 SQL 引擎功能。 数据库格式不断演变,以适应新功能。
  • SQLServer2022 - 该实例在其主流支持期内通过 SQL Server 2022 累积更新不断获取 SQL 引擎 bug 修复、安全修补程序和小功能改进。 在此期间,数据库格式与 SQL Server 2022 保持兼容。
类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

类型:IAzureContextContainer
别名:AzContext, AzureRmContext, AzureCredential
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-DnsZonePartner

要从中创建托管实例的合作伙伴托管服务器继承 DnsZone 属性的资源 ID

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Edition

实例的版本。

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-EnableActiveDirectoryOnlyAuthentication

在服务器上启用仅 Active Directory 身份验证。

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ExternalAdminName

指定服务器Microsoft Entra 管理员的用户、组或应用程序的显示名称。 此显示名称必须存在于与当前订阅关联的 Active Directory 中。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ExternalAdminSID

指定Microsoft Entra 管理员的用户、组或应用程序的对象 ID。

类型:Nullable<T>[Guid]
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Force

跳过执行操作的确认消息

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-IdentityType

要分配给服务器的标识类型。 可能的值为 SystemAsssigned、UserAssigned、'SystemAssigned、UserAssigned'和 None。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-InstancePool

实例池父对象。

类型:AzureSqlInstancePoolModel
别名:ParentObject
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-InstancePoolName

要放置此实例的实例池。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-InstancePoolResourceId

实例池资源 ID。

类型:String
别名:ResourceId
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-IsGeneralPurposeV2

这是否是常规用途版本的 GPv2 变体。

类型:Nullable<T>[Boolean]
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-KeyId

用于加密的 Azure 密钥库 URI。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-LicenseType

确定要使用的许可证类型。 可能的值为:

  • BasePrice - Azure 混合权益 (AHB) 现有 SQL Server 许可证所有者的折扣定价已应用。 现有 SQL Server 许可证所有者将折扣托管实例服务价格。
  • LicenseIncluded - 未应用现有 SQL Server 许可证所有者的 Azure 混合权益 (AHB) 折扣定价。 托管实例服务价格将包括新的 SQL Server 许可证成本。
类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Location

要在其中创建实例的位置

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-MaintenanceConfigurationId

Sql Azure 托管实例的维护配置 ID。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-MinimalTlsVersion

要为托管实例强制实施的最小 TLS 版本

类型:String
接受的值:None, 1.0, 1.1, 1.2
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Name

实例名称。

类型:String
别名:InstanceName
Position:0
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-PricingModel

实例的定价模型。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-PrimaryUserAssignedIdentityId

主要用户托管标识(UMI) ID。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ProxyOverride

用于连接到实例的连接类型。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-PublicDataEndpointEnabled

是否为实例启用公共数据终结点。

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ResourceGroupName

资源组的名称。

类型:String
Position:1
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-ServicePrincipalType

要使用的服务主体的类型。 可能的值为 SystemAssigned 和 None。

类型:String
接受的值:None, SystemAssigned
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-SkuName

实例的 SKU 名称,例如“GP_Gen4”、“BC_Gen4”。

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-StorageIOps

确定要与实例关联的存储 IOps 量

类型:Int32
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-StorageSizeInGB

确定要与实例关联的存储大小

类型:Int32
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-SubnetId

要用于创建实例的子网 ID

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-Tag

要与实例关联的标记

类型:Hashtable
别名:Tags
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-TimezoneId

要设置的实例的时区 ID。 时区 ID 列表通过 sys.time_zone_info (Transact-SQL) 视图公开。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-UserAssignedIdentityId

用户分配标识的列表。

类型:List<T>[String]
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-VCore

确定要与实例关联的 VCore 数量

类型:Int32
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-WhatIf

显示运行该 cmdlet 时会发生什么情况。 cmdlet 未运行。

类型:SwitchParameter
别名:wi
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ZoneRedundant

使用区域冗余存储

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

输入

None

输出

AzureSqlManagedInstanceModel