New-AzMySqlFlexibleServer
建立新的 MySQL 彈性伺服器。
語法
New-AzMySqlFlexibleServer
[-Name <String>]
[-ResourceGroupName <String>]
[-SubscriptionId <String>]
[-Location <String>]
[-Zone <String>]
[-AdministratorUserName <String>]
[-AdministratorLoginPassword <SecureString>]
[-Sku <String>]
[-SkuTier <String>]
[-BackupRetentionDay <Int32>]
[-StorageInMb <Int32>]
[-StorageAutogrow <StorageAutogrow>]
[-Iops <Int32>]
[-Tag <Hashtable>]
[-Version <ServerVersion>]
[-SubnetPrefix <String>]
[-Subnet <String>]
[-VnetPrefix <String>]
[-Vnet <String>]
[-PrivateDnsZone <String>]
[-PublicAccess <String>]
[-HighAvailability <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
建立新的 MySQL 彈性伺服器。
範例
範例 1:使用自變數建立新的 MySql 彈性伺服器
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzMySqlFlexibleServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -Location eastus -AdministratorUserName mysqltest -AdministratorLoginPassword $password -Sku Standard_D2ds_v4 -SkuTier Burstable -Version 12 -StorageInMb 20480 -PublicAccess none -Zone 1 -BackupRetentionDay 10 -StorageAutogrow Enabled -Iops 500 -HighAvailability ZoneRedundant
Checking the existence of the resource group PowershellMySqlTest ...
Resource group PowershellMySqlTest exists ? : True
Creating MySQL server mysql-test in group MySqlTest...
Your server mysql-test is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test East US Standard_D2ds_v4 GeneralPurpose admin 5.7 20
範例 2:使用預設設定建立新的 MySql 彈性伺服器
New-AzMySqlFlexibleServer
Creating resource group group00000000...
Creating new vnet VNETserver00000000 in resource group group00000000
Creating new subnet Subnetserver00000000 in resource group group00000000 and delegating it to Microsoft.DBforMySQL/flexibleServers
Creating MySQL server server00000000 in group group00000000...
Your server mysql-test is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details
Creating database flexibleserverdb...
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test West US 2 Standard_B1ms Burstable admin 5.7 32
此 Cmdlet 會建立具有預設參數值的 MySql 彈性伺服器,並在新的虛擬網路內布建伺服器,並將子網委派給伺服器。 位置的預設值是美國西部 2、Sku 是Standard_B1ms、Sku 層為高載,記憶體大小為 10GiB。
如果您想要尋找伺服器自動產生的密碼,請使用 ConvertFrom-SecureString 將 'SecuredPassword' 屬性轉換為純文本。
(例如,$server。SecuredPassword |ConvertFrom-SecureString -AsPlainText)
範例 3:使用現有的子網建立新的 MySql 彈性伺服器
$Subnet = '/subscriptions/00000000-0000-0000-0000-0000000000/resourceGroups/PowershellPostgreSqlTest/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnetname'
$DnsZone = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/postgresqltest/providers/Microsoft.Network/privateDnsZones/testserver.private.mysql.database.azure.com'
New-AzMySqlFlexibleServer -ResourceGroupName postgresqltest -ServerName testserver -Subnet $Subnet -PrivateDnsZone $DnsZone
Resource group PowershellPostgreSqlTest exists ? : True
You have supplied a subnet Id. Verifying its existence...
Creating PostgreSQL server testserver in group PowershellPostgreSqlTest...
Your server server00000000 is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/postgresql-pricing for pricing details
Creating database flexibleserverdb...
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test West US 2 Standard_B1ms Burstable admin 5.7 32
此 Cmdlet 會建立 PostgreSql 彈性伺服器,其中包含使用者所提供的現有子網標識符。 如果尚未委派,子網將會委派給 PostgreSQL 彈性伺服器。 您無法使用委派給不同服務的子網。
範例 4:使用虛擬網路和子網名稱建立新的 MySql 彈性伺服器
$DnsZone = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/postgresqltest/providers/Microsoft.Network/privateDnsZones/testserver.private.mysql.database.azure.com'
New-AzMySqlFlexibleServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -Vnet mysql-vnet -Subnet mysql-subnet -VnetPrefix 10.0.0.0/16 -SubnetPrefix 10.0.0.0/24 -PrivateDnsZone $DnsZone
Resource group PowershellMySqlTest exists ? : True
Creating new vnet mysql-vnet in resource group PowershellMySqlTest
Creating new subnet mysql-subnet in resource group PowershellMySqlTest and delegating it to Microsoft.DBforMySQL/flexibleServers
Creating MySQL server mysql-test in group PowershellMySqlTest...
Your server mysql-test is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details
Creating database flexibleserverdb...
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test West US 2 Standard_B1ms Burstable admin 5.7 32
此 Cmdlet 會建立具有 vnet 名稱、子網名稱、vnet 前綴和子網前綴的 MySql 彈性伺服器。 如果虛擬網路和子網不存在,Cmdlet 會建立一個。
範例 5:使用虛擬網路建立新的 MySql 彈性伺服器
$Vnet = 'vnetname'
$DnsZone = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/postgresqltest/providers/Microsoft.Network/privateDnsZones/testserver.private.mysql.database.azure.com'
New-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -Vnet $Vnet -PrivateDnsZone $DnsZone
# or
$Vnet = '/subscriptions/00000000-0000-0000-0000-0000000000/resourceGroups/PowershellMySqlTest/providers/Microsoft.Network/virtualNetworks/vnetname'
New-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -Vnet $Vnet -PrivateDnsZone $DnsZone
Resource group PowershellMySqlTest exists ? : True
You have supplied a vnet Id/name. Verifying its existence...
Creating new vnet vnetname in resource group PowershellMySqlTest
Creating new subnet Subnetserver00000000 in resource group PowershellMySqlTest and delegating it to Microsoft.DBforMySQL/flexibleServers
Creating MySQL server server00000000 in group PowershellMySqlTest...
Your server server00000000 is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details
Creating database flexibleserverdb...
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test West US 2 Standard_B1ms Burstable admin 5.7 32
此 Cmdlet 會建立具有 vnet 識別符或使用者所提供 vnet 名稱的 MySql 彈性伺服器。 如果虛擬網路不存在,Cmdlet 會建立一個。
範例 6:建立具有所有 IP 公用存取權的新 MySql 彈性伺服器
New-AzMySqlFlexibleServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -PublicAccess All
Resource group PowershellMySqlTest exists ? : True
Creating MySQL server mysql-test in group PowershellMySqlTest...
Your server mysql-test is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details
Creating database flexibleserverdb...
Configuring server firewall rule to accept connections from 0.0.0.0 to 255.255.255.255
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test West US 2 Standard_B1ms Burstable admin 5.7 32
此 Cmdlet 會建立開啟至所有 IP 位址的 MySql 彈性伺服器。
範例 7:使用防火牆建立新的 MySql 彈性伺服器
New-AzMySqlFlexibleServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -PublicAccess 10.10.10.10-10.10.10.12
Resource group PowershellMySqlTest exists ? : True
Creating MySQL server mysql-test in group PowershellMySqlTest...
Your server mysql-test is using sku Standard_B1ms (Paid Tier). Please refer to https://aka.ms/mysql-pricing for pricing details
Creating database flexibleserverdb...
Configuring server firewall rule to accept connections from 10.10.10.10 to 10.10.10.12
Name Location SkuName SkuTier AdministratorLogin Version StorageSizeGb
---- -------- ------- ------- ------------------ ------- -------------
mysql-test West US 2 Standard_B1ms Burstable admin 5.7 32
此 Cmdlet 會建立開啟至指定 IP 位址的 MySql 彈性伺服器。
參數
-AdministratorLoginPassword
系統管理員的密碼。 最少8個字元,最多128個字元。 密碼必須包含下列三個類別的字元:英文大寫字母、英文小寫字母、數位和非英數位元。
類型: | SecureString |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-AdministratorUserName
伺服器的系統管理員用戶名稱。 設定之後,就無法變更。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-AsJob
以作業身分執行命令。
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-BackupRetentionDay
伺服器的備份保留天數。 日計數介於 1 到 35 之間。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Confirm
在執行 Cmdlet 之前,提示您進行確認。
類型: | SwitchParameter |
別名: | cf |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DefaultProfile
用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。
類型: | PSObject |
別名: | AzureRMContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-HighAvailability
啟用或停用高可用性功能。 允許的值為 『ZoneRedundant』、『SameZone』和 『Disabled』。 預設值為 Disabled。
類型: | String |
別名: | HaEnabled |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Iops
要為此伺服器配置的 IOPS 數目。 您將根據布建的計算和記憶體,取得特定數量的免費 IOPS。 IOPS 的預設值為免費的 IOPS。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Location
資源所在的位置。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Name
伺服器的名稱。
類型: | String |
別名: | ServerName |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-NoWait
以異步方式執行命令。
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-PrivateDnsZone
現有私人 DNS 區域的識別碼。 dns 區域的後綴必須與伺服器的完整網域相同。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-PublicAccess
判斷公用存取。 允許的值:全部、無、IP 位址範圍(例如 1.1.1.1.1-1.1.5、1.1.1.1.1)指定 0.0.0.0 允許從 Azure 內部署的任何資源公開存取您的伺服器。 未指定IP位址會以公用存取模式設定伺服器,但不會建立防火牆規則。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceGroupName
包含資源的資源群組名稱,您可以從 Azure Resource Manager API 或入口網站取得此值。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Sku
sku 的名稱,通常是階層 + 系列 + 核心,例如Standard_B1ms,Standard_D2ds_v4。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-SkuTier
伺服器的計算層。 接受的值:高載、GeneralPurpose、記憶體優化。 默認值:可高載。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-StorageAutogrow
啟用或停用記憶體自動成長。 預設值為 Disabled
類型: | StorageAutogrow |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-StorageInMb
伺服器允許的最大記憶體。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Subnet
現有子網的名稱或標識碼,或要建立之新子網的名稱。 如果您想要使用來自不同資源群組的子網,請使用資源識別碼。 請注意,子網將會委派給 Microsoft.DBforMySQL/flexibleServers。 委派之後,此子網無法用於任何其他類型的 Azure 資源。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-SubnetPrefix
以 CIDR 格式建立新 vnet 時要使用的子網 IP 位址前綴。 預設值為 10.0.0.0/24。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-SubscriptionId
識別 Azure 訂用帳戶的訂用帳戶標識碼。
類型: | String |
Position: | Named |
預設值: | (Get-AzContext).Subscription.Id |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Tag
以索引鍵/值組形式的應用程式特定元數據。
類型: | Hashtable |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Version
伺服器版本。
類型: | ServerVersion |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Vnet
現有虛擬網路的名稱或要建立之新虛擬網路的名稱或標識碼。 名稱必須介於 2 到 64 個字元之間。 名稱的開頭必須是字母或數位、以字母、數位或底線結尾,而且只能包含字母、數位、底線、句號或連字元。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-VnetPrefix
以 CIDR 格式建立新 vnet 時要使用的 IP 位址前綴。 預設值為 10.0.0.0/16。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Zone
要在其中布建資源的可用性區域。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |