通过 Azure 资源管理器(ARM)模板为 Azure 密钥保管库创建网络安全边界,开始实施网络安全防护措施。 网络安全外围允许 Azure 平台即服务(PaaS)资源在显式受信任的边界内通信。 在网络安全外围配置文件中创建和更新 PaaS 资源的关联。 然后,创建和更新网络安全外围访问规则。 完成后,请删除在本快速入门中创建的所有资源。
Azure 资源管理器模板是一个 JavaScript 对象表示法(JSON)文件,用于定义项目的基础结构和配置。 模板使用声明性语法。 你可以在不编写用于创建部署的编程命令序列的情况下,描述预期部署。
还可以使用 Azure 门户、 Azure PowerShell 或 Azure CLI 创建网络安全外围。
如果你的环境满足先决条件,并且你熟悉使用 ARM 模板,请选择此处的“ 部署到 Azure ”按钮。 ARM 模板将在 Azure 门户中打开。
先决条件
- 拥有有效订阅的 Azure 帐户。 如果还没有 Azure 帐户, 请创建一个试用订阅。
查看模板
此模板为 Azure SQL 数据库的实例创建专用终结点。
本快速入门使用的模板来自 Azure 快速入门模板。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.33.93.31351",
"templateHash": "13000240630105370736"
}
},
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"keyVaultName": {
"type": "string",
"defaultValue": "[format('kv-{0}', uniqueString(resourceGroup().id))]"
},
"nspName": {
"type": "string",
"defaultValue": "networkSecurityPerimeter"
},
"profileName": {
"type": "string",
"defaultValue": "profile1"
},
"inboundIpv4AccessRuleName": {
"type": "string",
"defaultValue": "inboundRule"
},
"outboundFqdnAccessRuleName": {
"type": "string",
"defaultValue": "outboundRule"
},
"associationName": {
"type": "string",
"defaultValue": "networkSecurityPerimeterAssociation"
}
},
"resources": [
{
"type": "Microsoft.KeyVault/vaults",
"apiVersion": "2022-07-01",
"name": "[parameters('keyVaultName')]",
"location": "[parameters('location')]",
"properties": {
"sku": {
"family": "A",
"name": "standard"
},
"tenantId": "[subscription().tenantId]",
"accessPolicies": [],
"enabledForDeployment": false,
"enabledForDiskEncryption": false,
"enabledForTemplateDeployment": false,
"enableSoftDelete": true,
"softDeleteRetentionInDays": 90,
"enableRbacAuthorization": false
}
},
{
"type": "Microsoft.Network/networkSecurityPerimeters",
"apiVersion": "2023-07-01-preview",
"name": "[parameters('nspName')]",
"location": "[parameters('location')]",
"properties": {}
},
{
"type": "Microsoft.Network/networkSecurityPerimeters/profiles",
"apiVersion": "2023-07-01-preview",
"name": "[format('{0}/{1}', parameters('nspName'), parameters('profileName'))]",
"location": "[parameters('location')]",
"properties": {},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityPerimeters', parameters('nspName'))]"
]
},
{
"type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules",
"apiVersion": "2023-07-01-preview",
"name": "[format('{0}/{1}/{2}', parameters('nspName'), parameters('profileName'), parameters('inboundIpv4AccessRuleName'))]",
"location": "[parameters('location')]",
"properties": {
"direction": "Inbound",
"addressPrefixes": [
"100.10.0.0/16"
],
"fullyQualifiedDomainNames": [],
"subscriptions": [],
"emailAddresses": [],
"phoneNumbers": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', parameters('nspName'), parameters('profileName'))]"
]
},
{
"type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules",
"apiVersion": "2023-07-01-preview",
"name": "[format('{0}/{1}/{2}', parameters('nspName'), parameters('profileName'), parameters('outboundFqdnAccessRuleName'))]",
"location": "[parameters('location')]",
"properties": {
"direction": "Outbound",
"addressPrefixes": [],
"fullyQualifiedDomainNames": [
"contoso.com"
],
"subscriptions": [],
"emailAddresses": [],
"phoneNumbers": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', parameters('nspName'), parameters('profileName'))]"
]
},
{
"type": "Microsoft.Network/networkSecurityPerimeters/resourceAssociations",
"apiVersion": "2023-07-01-preview",
"name": "[format('{0}/{1}', parameters('nspName'), parameters('associationName'))]",
"location": "[parameters('location')]",
"properties": {
"privateLinkResource": {
"id": "[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]"
},
"profile": {
"id": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', parameters('nspName'), parameters('profileName'))]"
},
"accessMode": "Enforced"
},
"dependsOn": [
"[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]",
"[resourceId('Microsoft.Network/networkSecurityPerimeters', parameters('nspName'))]",
"[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', parameters('nspName'), parameters('profileName'))]"
]
}
]
}
该模板定义多个 Azure 资源:
- Microsoft.KeyVault/vaults:包含示例数据库的 Key Vault 实例。
- Microsoft.Network/networkSecurityPerimeters:用于访问 Key Vault 实例的网络安全外围。
- Microsoft.Network/networkSecurityPerimeters/profiles:用于访问 Key Vault 实例的网络安全外围配置文件。
- Microsoft.Network/networkSecurityPerimeters/profiles/accessRules:用于访问 Key Vault 实例的访问规则。
- Microsoft.Network/networkSecurityPerimeters/resourceAssociations:用于访问 Key Vault 实例的资源关联。
部署模板
通过执行以下作将 ARM 模板部署到 Azure:
通过在此处选择“ 部署到 Azure ”按钮登录到 Azure 并打开 ARM 模板。 该模板创建网络安全外围和 Azure Key Vault 实例。
选择你的资源组,或新建一个资源组。
输入 SQL 管理员登录名和密码。
输入虚拟机管理员用户名和密码。
阅读条款和条件声明。 如果你同意,请选择 “我同意上述条款和条件”,然后选择“ 购买”。 部署可能需要 20 分钟或更长时间才能完成。
验证部署
清理资源
不再需要使用专用终结点创建的资源时,请删除资源组。 这样做会删除专用终结点和所有相关资源。
若要删除资源组,请运行 Remove-AzResourceGroup cmdlet:
Remove-AzResourceGroup -Name <your resource group name>
后续步骤
有关支持专用终结点的服务的详细信息,请参阅: