التشغيل السريع: إنشاء مثيل مُدار من Azure SQL باستخدام قالب ARM
يركز هذا البدء السريع على عملية نشر قالب Azure Resource Manager (قالب ARM) لإنشاء Azure SQL Managed Instance و vNet. Azure SQL Managed Instanceعبارة عن قاعدة بيانات سحابية ذكية ومدارة بالكامل وقابلة للتطوير، مع تكافؤ في الميزات بنسبة 100% تقريبًا مع محرك قاعدة بيانات SQL Server.
نموذج ARM هو ملف JavaScript Object Notation (JSON) الذي يُعرف البنية الأساسية والتكوين للمشروع الخاص بك. يستخدم النموذج عبارات توضيحية. خلال العبارات التوضيحية، تصف عملية الإرسال المقصودة دون تسلسل لأوامر البرمجة لهذا الغرض.
إذا كانت بيئتك تلبي المتطلبات الأساسية وكنت معتاداً على استخدام قوالب إدارة "ARM"، فحدد الزرتوزيع في Azure. سيتم فتح القالب في مدخل "Azure".
المتطلبات الأساسية
في حال لم يكن لديك اشتراك Azure، فأنشئ حسابًا مجانيًا.
راجع القالب
القالب المستخدم في هذا الـبدء السريع مأخوذ من Azure Quickstart Templates.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.6.1.6515",
"templateHash": "13317687096436273875"
}
},
"parameters": {
"managedInstanceName": {
"type": "string",
"metadata": {
"description": "Enter managed instance name."
}
},
"administratorLogin": {
"type": "string",
"metadata": {
"description": "Enter user name."
}
},
"administratorLoginPassword": {
"type": "secureString",
"metadata": {
"description": "Enter password."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Enter location. If you leave this field blank resource group location would be used."
}
},
"virtualNetworkName": {
"type": "string",
"defaultValue": "SQLMI-VNET",
"metadata": {
"description": "Enter virtual network name. If you leave this field blank name will be created by the template."
}
},
"addressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16",
"metadata": {
"description": "Enter virtual network address prefix."
}
},
"subnetName": {
"type": "string",
"defaultValue": "ManagedInstance",
"metadata": {
"description": "Enter subnet name."
}
},
"subnetPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/24",
"metadata": {
"description": "Enter subnet address prefix."
}
},
"skuName": {
"type": "string",
"defaultValue": "GP_Gen5",
"allowedValues": [
"GP_Gen5",
"BC_Gen5"
],
"metadata": {
"description": "Enter sku name."
}
},
"vCores": {
"type": "int",
"defaultValue": 16,
"allowedValues": [
8,
16,
24,
32,
40,
64,
80
],
"metadata": {
"description": "Enter number of vCores."
}
},
"storageSizeInGB": {
"type": "int",
"defaultValue": 256,
"maxValue": 8192,
"minValue": 32,
"metadata": {
"description": "Enter storage size."
}
},
"licenseType": {
"type": "string",
"defaultValue": "LicenseIncluded",
"allowedValues": [
"BasePrice",
"LicenseIncluded"
],
"metadata": {
"description": "Enter license type."
}
}
},
"variables": {
"networkSecurityGroupName": "[format('SQLMI-{0}-NSG', parameters('managedInstanceName'))]",
"routeTableName": "[format('SQLMI-{0}-Route-Table', parameters('managedInstanceName'))]"
},
"resources": [
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2021-08-01",
"name": "[variables('networkSecurityGroupName')]",
"location": "[parameters('location')]",
"properties": {
"securityRules": [
{
"name": "allow_tds_inbound",
"properties": {
"description": "Allow access to data",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "1433",
"sourceAddressPrefix": "VirtualNetwork",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound"
}
},
{
"name": "allow_redirect_inbound",
"properties": {
"description": "Allow inbound redirect traffic to Managed Instance inside the virtual network",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "11000-11999",
"sourceAddressPrefix": "VirtualNetwork",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1100,
"direction": "Inbound"
}
},
{
"name": "deny_all_inbound",
"properties": {
"description": "Deny all other inbound traffic",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 4096,
"direction": "Inbound"
}
},
{
"name": "deny_all_outbound",
"properties": {
"description": "Deny all other outbound traffic",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 4096,
"direction": "Outbound"
}
}
]
}
},
{
"type": "Microsoft.Network/routeTables",
"apiVersion": "2021-08-01",
"name": "[variables('routeTableName')]",
"location": "[parameters('location')]",
"properties": {
"disableBgpRoutePropagation": false
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-08-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('addressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters('subnetPrefix')]",
"routeTable": {
"id": "[resourceId('Microsoft.Network/routeTables', variables('routeTableName'))]"
},
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
},
"delegations": [
{
"name": "managedInstanceDelegation",
"properties": {
"serviceName": "Microsoft.Sql/managedInstances"
}
}
]
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]",
"[resourceId('Microsoft.Network/routeTables', variables('routeTableName'))]"
]
},
{
"type": "Microsoft.Sql/managedInstances",
"apiVersion": "2021-11-01-preview",
"name": "[parameters('managedInstanceName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('skuName')]"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"administratorLogin": "[parameters('administratorLogin')]",
"administratorLoginPassword": "[parameters('administratorLoginPassword')]",
"subnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]",
"storageSizeInGB": "[parameters('storageSizeInGB')]",
"vCores": "[parameters('vCores')]",
"licenseType": "[parameters('licenseType')]"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
}
]
}
يتم تحديد هذه الموارد في النموذج:
- Microsoft.Network/networkSecurityGroups
- Microsoft.Network/routeTables
- Microsoft.Network/virtualNetworks
- Microsoft.Sql/managedinstances
يمكن العثور على المزيد من نماذج القوالب في نماذجAzure Quickstart Templates.
نشر القالب
حدد جربه من كتلة التعليمات البرمجية PowerShell التالية لفتح Azure Cloud Shell.
هام
يعد توزيع مثيل مُدار عملية تشغيل طويلة. عادةً ما يستغرق نشر المثيل الأول في الشبكة الفرعية وقتًا أطول بكثير من النشر في شبكة فرعية مع الطبعات المدارة الحالية. لمزيد من المعلومات حول أوقات التوفير، راجع عمليات إدارة مثيلات SQL المُدارة.
$projectName = Read-Host -Prompt "Enter a project name that is used for generating resource names"
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
$templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.sql/sqlmi-new-vnet/azuredeploy.json"
$resourceGroupName = "${projectName}rg"
New-AzResourceGroup -Name $resourceGroupName -Location $location
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri
Read-Host -Prompt "Press [ENTER] to continue ..."
مراجعة الموارد المنشورة
قم بزيارة مدخل Azure وتحقق من وجود المثيل المدار في مجموعة الموارد المحددة. نظرًا إلى أن إنشاء مثيل مدار قد يستغرق بعض الوقت، فقد تحتاج إلى التحقق من ارتباط النشرات في صفحة نظرة عامة على مجموعة الموارد.
- للحصول على بداية سريعة توضح كيفية الاتصال SQL المثيل المدار من جهاز ظاهري Azure، راجع تكوين اتصال الجهاز الظاهري Azure.
- للحصول على بدء تشغيل سريع يوضح كيفية الاتصال SQL المثيل المدار من كمبيوتر عميل محلي باستخدام اتصال من نقطة إلى موقع، راجع تكوين اتصال من نقطة إلى موقع.
تنظيف الموارد
احتفظ بالمثيل المدار إذا كنت تريد الانتقال إلى الخطوات التالية، ولكن احذف المثيل المدار والموارد ذات الصلة بعد إكمال أي دروس إضافية. بعد حذف مثيل مدار، راجع حذف شبكة فرعية بعد حذف مثيل مدار.
لحذف مجموعة الموارد:
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
Remove-AzResourceGroup -Name $resourceGroupName