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

使用 ARM 模板配置服务和 SIM 策略

服务和 SIM 策略是 Azure 专用 5G 核心的可自定义策略控制机制(可用于提供灵活的流量处理)的关键组件。 可以准确确定数据包核心实例如何将服务质量 (QoS) 特征应用于服务数据流 (SDF) 以满足部署需求。 有关详细信息,请参阅策略控制。 本操作指南介绍如何使用 Azure 资源管理器模板(ARM 模板)创建简单的服务和 SIM 策略。

Azure 资源管理器模板是定义项目基础结构和配置的 JavaScript 对象表示法 (JSON) 文件。 模板使用声明性语法。 你可以在不编写用于创建部署的编程命令序列的情况下,描述预期部署。

如果你的环境满足先决条件,并且你熟悉如何使用 ARM 模板,请选择“部署到 Azure”按钮。 Azure 门户中会打开模板。

Button to deploy the Resource Manager template to Azure.

先决条件

  • 确保可以使用一个有权访问用于创建专用移动网络的活动订阅的帐户登录到 Azure 门户。 此帐户必须具有订阅范围的内置参与者角色。

  • 确定与专用移动网络对应的移动网络资源的名称,以及包含该资源的资源组。

  • 确定你部署私有移动网络的 Azure 区域。

  • 标识要向其分配 SIM 策略的网络切片的名称。

  • 标识要向其分配新策略的数据网络的名称。

  • ARM 模板中填充了用于配置允许双向传输所有流量的默认服务和 SIM 策略的值。

    如果你想出于其他目的创建服务和 SIM 策略,请使用收集服务所需的信息收集 SIM 策略所需的信息中的信息根据要求设计服务和 SIM 策略。 在部署 ARM 模板的过程中,你将输入这些新值。

查看模板

本操作指南中使用的模板来自 Azure 快速入门模板

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.22.6.54827",
      "templateHash": "7793736700363560682"
    }
  },
  "parameters": {
    "location": {
      "type": "string",
      "metadata": {
        "description": "Region where the Mobile Network will be deployed (must match the resource group region)"
      }
    },
    "existingMobileNetworkName": {
      "type": "string",
      "metadata": {
        "description": "Name of the Mobile Network to add a SIM policy to"
      }
    },
    "existingSliceName": {
      "type": "string",
      "metadata": {
        "description": "Name of the existing slice to use for the SIM policy"
      }
    },
    "existingDataNetworkName": {
      "type": "string",
      "metadata": {
        "description": "Name of the existing data network to use for the SIM policy"
      }
    },
    "serviceName": {
      "type": "string",
      "defaultValue": "Allow_all_traffic",
      "metadata": {
        "description": "The name of the service"
      }
    },
    "serviceMaximumBitRateUplink": {
      "type": "string",
      "defaultValue": "2 Gbps",
      "metadata": {
        "description": "The maximum bit rate (MBR) for uploads across all service data flows that match data flow policy rules configured on the generic service"
      }
    },
    "serviceMaximumBitRateDownlink": {
      "type": "string",
      "defaultValue": "2 Gbps",
      "metadata": {
        "description": "The maximum bit rate (MBR) for downloads across all service data flows that match data flow policy rules configured on the generic service"
      }
    },
    "servicePrecedence": {
      "type": "int",
      "defaultValue": 253,
      "minValue": 0,
      "maxValue": 255,
      "metadata": {
        "description": "The precedence value for the service being deployed."
      }
    },
    "dataFlowPolicyRuleName": {
      "type": "string",
      "defaultValue": "All_traffic",
      "metadata": {
        "description": "The name of the data flow policy rule that will be created for this service."
      }
    },
    "dataFlowPolicyRulePrecedence": {
      "type": "int",
      "defaultValue": 253,
      "minValue": 0,
      "maxValue": 255,
      "metadata": {
        "description": "The precedence value for the data flow policy rule being created."
      }
    },
    "dataFlowPolicyRuleTrafficControl": {
      "type": "string",
      "defaultValue": "Enabled",
      "allowedValues": [
        "Enabled",
        "Blocked"
      ],
      "metadata": {
        "description": "Whether flows matching this data flow policy rule are permitted or blocked."
      }
    },
    "dataFlowTemplateProtocols": {
      "type": "array",
      "defaultValue": [
        "ip"
      ],
      "metadata": {
        "description": "Which protocols match this data flow policy rule. This should be either a list of IANA protocol numbers or the special value \"ip\""
      }
    },
    "dataFlowTemplateName": {
      "type": "string",
      "defaultValue": "ip_traffic",
      "metadata": {
        "description": "The name of the data flow template that will be created for this service."
      }
    },
    "dataFlowTemplateDirection": {
      "type": "string",
      "defaultValue": "Bidirectional",
      "allowedValues": [
        "Uplink",
        "Downlink",
        "Bidirectional"
      ],
      "metadata": {
        "description": "The direction of the flow to match with this data flow policy rule."
      }
    },
    "dataFlowTemplateRemoteIps": {
      "type": "array",
      "defaultValue": [
        "any"
      ],
      "metadata": {
        "description": "The remote IP addresses that UEs will connect to for this flow. This should be either a list of IP addresses or the special value \"any\""
      }
    },
    "simPolicyName": {
      "type": "string",
      "defaultValue": "Default-policy",
      "metadata": {
        "description": "The name of the SIM policy"
      }
    },
    "totalBandwidthAllowedUplink": {
      "type": "string",
      "defaultValue": "2 Gbps",
      "metadata": {
        "description": "The UE aggregated maximum bit rate (UE-AMBR) for uploads across all non-GBR QoS flows for a particular UE"
      }
    },
    "totalBandwidthAllowedDownlink": {
      "type": "string",
      "defaultValue": "2 Gbps",
      "metadata": {
        "description": "The UE aggregated maximum bit rate (UE-AMBR) for downloads across all non-GBR QoS flows for a particular UE"
      }
    },
    "sessionAggregateMaximumBitRateUplink": {
      "type": "string",
      "defaultValue": "2 Gbps",
      "metadata": {
        "description": "The session aggregated maximum bit rate (Session-AMBR) for uploads across all non-GBR QoS flows of an individual PDU session involving a particular UE"
      }
    },
    "sessionAggregateMaximumBitRateDownlink": {
      "type": "string",
      "defaultValue": "2 Gbps",
      "metadata": {
        "description": "The session aggregated maximum bit rate (Session-AMBR) for downloads across all non-GBR QoS flows of an individual PDU session involving a particular UE"
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.MobileNetwork/mobileNetworks/services",
      "apiVersion": "2023-09-01",
      "name": "[format('{0}/{1}', parameters('existingMobileNetworkName'), parameters('serviceName'))]",
      "location": "[parameters('location')]",
      "properties": {
        "servicePrecedence": "[parameters('servicePrecedence')]",
        "serviceQosPolicy": {
          "maximumBitRate": {
            "uplink": "[parameters('serviceMaximumBitRateUplink')]",
            "downlink": "[parameters('serviceMaximumBitRateDownlink')]"
          }
        },
        "pccRules": [
          {
            "ruleName": "[parameters('dataFlowPolicyRuleName')]",
            "rulePrecedence": "[parameters('dataFlowPolicyRulePrecedence')]",
            "trafficControl": "[parameters('dataFlowPolicyRuleTrafficControl')]",
            "serviceDataFlowTemplates": [
              {
                "templateName": "[parameters('dataFlowTemplateName')]",
                "protocol": "[parameters('dataFlowTemplateProtocols')]",
                "direction": "[parameters('dataFlowTemplateDirection')]",
                "remoteIpList": "[parameters('dataFlowTemplateRemoteIps')]"
              }
            ]
          }
        ]
      }
    },
    {
      "type": "Microsoft.MobileNetwork/mobileNetworks/simPolicies",
      "apiVersion": "2023-09-01",
      "name": "[format('{0}/{1}', parameters('existingMobileNetworkName'), parameters('simPolicyName'))]",
      "location": "[parameters('location')]",
      "properties": {
        "ueAmbr": {
          "uplink": "[parameters('totalBandwidthAllowedUplink')]",
          "downlink": "[parameters('totalBandwidthAllowedDownlink')]"
        },
        "defaultSlice": {
          "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks/slices', parameters('existingMobileNetworkName'), parameters('existingSliceName'))]"
        },
        "sliceConfigurations": [
          {
            "slice": {
              "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks/slices', parameters('existingMobileNetworkName'), parameters('existingSliceName'))]"
            },
            "defaultDataNetwork": {
              "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks/dataNetworks', parameters('existingMobileNetworkName'), parameters('existingDataNetworkName'))]"
            },
            "dataNetworkConfigurations": [
              {
                "dataNetwork": {
                  "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks/dataNetworks', parameters('existingMobileNetworkName'), parameters('existingDataNetworkName'))]"
                },
                "sessionAmbr": {
                  "uplink": "[parameters('sessionAggregateMaximumBitRateUplink')]",
                  "downlink": "[parameters('sessionAggregateMaximumBitRateDownlink')]"
                },
                "allowedServices": [
                  {
                    "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks/services', parameters('existingMobileNetworkName'), parameters('serviceName'))]"
                  }
                ]
              }
            ]
          }
        ]
      },
      "dependsOn": [
        "[resourceId('Microsoft.MobileNetwork/mobileNetworks/services', parameters('existingMobileNetworkName'), parameters('serviceName'))]"
      ]
    }
  ]
}

该模板中定义了两个 Azure 资源。

部署模板

  1. 选择以下链接登录到 Azure 并打开一个模板。

    Button to deploy the Resource Manager template to Azure.

  2. 使用在先决条件中检索的信息,选择或输入以下值。

    • 订阅:选择在创建专用移动网络时使用的 Azure 订阅
    • 资源组:选择包含代表该专用移动网络的移动网络资源的资源组
    • 区域:选择你部署专用移动网络的区域。
    • 位置:输入你部署专用移动网络的区域的代码名称
    • 现有移动网络名称:输入代表该专用移动网络的移动网络资源的名称
    • 现有切片名称:输入表示网络切片的切片资源的名称
    • 现有数据网络名称:输入数据网络的名称。 此值必须与创建数据网络时使用的名称相匹配。
  3. 若要使用默认服务和 SIM 策略,请将其余字段保留原样。 否则,请使用在收集服务所需的信息收集 SIM 策略所需的信息中收集的信息,填写其余字段以匹配你要配置的服务和 SIM 策略。

  4. 选择“查看 + 创建”。

  5. 现在,Azure 将验证你输入的配置值。 应会看到一条消息,指出你的值已通过验证。

    如果验证失败,你将看到一条错误消息,并且“配置”选项卡中会标记无效的配置。 选择带标记的选项卡并根据错误消息更正无效配置,然后返回到“查看 + 创建”选项卡。

  6. 验证配置后,可以选择“创建”来创建服务和 SIM 策略。 部署完成后,Azure 门户会显示确认屏幕。

查看已部署的资源

  1. 在确认屏幕上,选择“转到资源组”。

    Screenshot of the Azure portal showing a deployment confirmation for the ARM template.

  2. 确认资源组中已创建你的服务和 SIM 策略。

    Screenshot of the Azure portal showing a resource group containing newly provisioned SIMs.

后续步骤

现在可将 SIM 策略分配到 SIM,以将其引入服务。