我需要使用PowerShell脚本(AzureRm.Sql)自动创建Azure SQL数据库托管实例。应该使用什么命令来创建它?
答案 0 :(得分:1)
如果已安装AzureRm.Sql并已正确配置网络环境(VNet和子网),则可以使用以下脚本来部署最大存储量为1024的8核“通用”实例:
Select-AzureRmSubscription -Subscription "60d9f1df-......"
$resourceGroup = "<resource group>"
$vNetName = "<VNet name"
$subnetName = "<subnet name>"
$instanceName = "<subnet name>"
$region = "South India"
$vNet = Get-AzureRmVirtualNetwork -Name $vNetName -ResourceGroupName $resourceGroup
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name $SubnetName -VirtualNetwork $vNet
$subnetId = $subnet.Id
New-AzureRmSqlManagedInstance -Name $instanceName `
-ResourceGroupName $resourceGroup -Location $region -SubnetId $subnetId `
-AdministratorCredential (Get-Credential) `
-StorageSizeInGB 1024 -VCore 8 -Edition "GeneralPurpose" `
-ComputeGeneration Gen5 -LicenseType BasePrice