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

为 Azure 专用 5G 核心预配新的 SIM - ARM 模板

SIM 资源表示用户设备 (UE) 使用的物理 SIM 或 eSIM,由专用移动网络提供。 本操作指南介绍如何使用 Azure 资源管理器模板(ARM 模板)为现有专用移动网络预配新的 SIM。

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

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

用于将资源管理器模板部署到 Azure 的按钮。

先决条件

  • 确保你可以使用一个对在完成部署专用移动网络的先决条件任务中标识的活动订阅具有访问权限的帐户登录 Azure 门户。 此帐户必须具有订阅范围内的内置参与者角色。
  • 确定与专用移动网络对应的移动网络资源的名称,以及包含该资源的资源组。
  • 确定你部署私有移动网络的 Azure 区域。
  • 为要向其添加 SIM 的新 SIM 组选择名称。
  • 确定要分配给要预配的 SIM 的 SIM 策略。 必须已根据配置 SIM 策略 - Azure 门户中的说明创建了此 SIM 策略。

收集所需的 SIM 信息

开始之前,请为要预配的每个 SIM 收集下表中的值。

参数名称
SIM 名称。 此 SIM 名称只能包含字母数字字符、短划线或下划线。 simName
集成线路卡标识号 (ICCID)。 ICCID 标识特定的物理 SIM 或 eSIM,并且包括有关 SIM 的国家/地区和颁发者的信息。 ICCID 是可选的,并且是长度介于 19 和 20 位之间的唯一数字值,从 89 开始。 integratedCircuitCardIdentifier
国际移动用户标识 (IMSI)。 IMSI 是标识移动网络中设备或用户的唯一数字(通常是 15 位)。 internationalMobileSubscriberIdentity
身份验证密钥 (Ki)。 Ki 是由操作员分配给 SIM 的唯一 128 位值,与派生的运算符代码 (OPc) 一起使用,对用户进行身份验证。 它必须是 32 字符的字符串,仅包含十六进制字符。 authenticationKey
派生的运算符代码 (OPc)。 OPc 取自 SIM 的 Ki 和网络运算符代码 (OP)。 数据包核心实例使用基于标准的算法对用户进行身份验证。 OPc 必须是 32 字符的字符串,仅包含十六进制字符。 operatorKeyCode
使用此 SIM 的设备类型。 此值是可选的自由格式字符串。 你可以根据需要使用它来轻松识别使用企业专用移动网络的设备类型。 deviceType
要分配给 SIM 的 SIM 策略。 这是可选的,但如果没有分配的 SIM 策略,SIM 将无法使用专用移动网络。 simPolicyId

收集分配静态 IP 地址所需的信息

仅当满足以下所有条件时,才需完成以下步骤:

  • 你将使用一个或多个 JSON 数组来预配 SIM。
  • 你已为 Packet Core 实例配置了静态 IP 地址分配。
  • 你希望在 SIM 预配期间为 SIM 分配静态 IP 地址。

请为要预配的每个 SIM 收集下表中的值。 如果你的专用移动网络有多个数据网络,并且你希望针对每个数据网络为此 SIM 分配不同的静态 IP 地址,请收集每个 IP 地址的值。

每个 IP 地址都必须来自你在创建相关数据网络时为静态 IP 地址分配所分配的池,如收集数据网络值中所述。 有关详细信息,请参阅分配用户设备 (UE) IP 地址池

Azure 门户中的字段名称 JSON 参数名称
SIM 将使用的数据网络。 不适用。 staticIpConfiguration.attachedDataNetworkId
SIM 将使用的网络切片。 不适用。 staticIpConfiguration.sliceId
要分配给 SIM 的静态 IP 地址。 不适用。 staticIpConfiguration.staticIpAddress

为 SIM 准备一个或多个 JSON 数组

使用你在收集所需的 SIM 信息中收集的信息创建一个或多个 JSON 数组,其中包含要预配的最多 1000 个 SIM 的属性。 下面是包含两个 SIM 属性(SIM1SIM2)的数组的示例。

如果现在不想分配 SIM 策略或静态 IP 地址,则可删除 simPolicy 和/或 staticIpConfiguration 参数。

注意

API 请求正文的最大大小为 4MB。 建议每个 JSON 数组最多输入 1000 个 SIM,以保持低于此限制。 如果要预配超过 1000 个 SIM,请创建多个数组并为每个数组重复预配过程。 或者,可以使用 Azure 门户为每个 JSON 文件预配最多 10,000 个 SIM。

[
 {
  "simName": "SIM1",
  "integratedCircuitCardIdentifier": "8912345678901234566",
  "internationalMobileSubscriberIdentity": "001019990010001",
  "authenticationKey": "00112233445566778899AABBCCDDEEFF",
  "operatorKeyCode": "63bfa50ee6523365ff14c1f45f88737d",
  "deviceType": "Cellphone",
  "simPolicyId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/mobileNetworks/contoso-network/simPolicies/SimPolicy1",
  "staticIpConfiguration" :[
	{
	  "attachedDataNetworkId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/site-1/packetCoreDataPlanes/site-1/attachedDataNetworks/adn1",
	  "sliceId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/mobileNetworks/contoso-network/slices/slice-1",
	  "staticIpAddress": "10.132.124.54"
	},
    {
	  "attachedDataNetworkId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/site-1/packetCoreDataPlanes/site-1/attachedDataNetworks/adn2",
	  "sliceId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/mobileNetworks/contoso-network/slices/slice-1",
	  "staticIpAddress": "10.132.124.55"
	}
   ]
 },
 {
  "simName": "SIM2",
  "integratedCircuitCardIdentifier": "8922345678901234567",
  "internationalMobileSubscriberIdentity": "001019990010002",
  "authenticationKey": "11112233445566778899AABBCCDDEEFF",
  "operatorKeyCode": "63bfa50ee6523365ff14c1f45f88738d",
  "deviceType": "Sensor",
  "simPolicyId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/mobileNetworks/contoso-network/simPolicies/SimPolicy2",
  "staticIpConfiguration" :[
	{
	  "attachedDataNetworkId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/site-1/packetCoreDataPlanes/site-1/attachedDataNetworks/adn1",
	  "sliceId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/mobileNetworks/contoso-network/slices/slice-1",
	  "staticIpAddress": "10.132.124.54"
	},
	{
	  "attachedDataNetworkId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/site-1/packetCoreDataPlanes/site-1/attachedDataNetworks/adn2",
	  "sliceId": "/subscriptions/subid/resourceGroups/contoso-rg/providers/Microsoft.MobileNetwork/mobileNetworks/contoso-network/slices/slice-1",
	  "staticIpAddress": "10.132.124.55"
	}
   ]
 }
]

查看模板

本快速入门中使用的模板来自 Azure 快速启动模板

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.25.53.49325",
      "templateHash": "9173523895323587869"
    }
  },
  "parameters": {
    "location": {
      "type": "string",
      "metadata": {
        "description": "Region where the SIM group will be deployed (must match the resource group region)."
      }
    },
    "existingMobileNetworkName": {
      "type": "string",
      "metadata": {
        "description": "The name of the mobile network to which you are adding the SIM group."
      }
    },
    "existingSimPolicyName": {
      "type": "string",
      "metadata": {
        "description": "The name of the SIM policy to be assigned to the SIM(s)."
      }
    },
    "simGroupName": {
      "type": "string",
      "metadata": {
        "description": "The name for the SIM group."
      }
    },
    "existingEncryptionKeyUrl": {
      "type": "string",
      "defaultValue": "",
      "metadata": {
        "description": "A unversioned key vault key to encrypt the SIM data that belongs to this SIM group. For example: https://contosovault.vault.azure.net/keys/azureKey."
      }
    },
    "existingUserAssignedIdentityResourceId": {
      "type": "string",
      "defaultValue": "",
      "metadata": {
        "description": "User-assigned identity is an identity in Azure Active Directory that can be used to give access to other Azure resource such as Azure Key Vault. This identity should have Get, Wrap key, and Unwrap key permissions on the key vault."
      }
    },
    "simResources": {
      "type": "array",
      "metadata": {
        "description": "An array containing properties of the SIM(s) you wish to create. See [Provision proxy SIM(s)](https://docs.microsoft.com/en-gb/azure/private-5g-core/provision-sims-azure-portal) for a full description of the required properties and their format."
      }
    }
  },
  "resources": [
    {
      "copy": {
        "name": "exampleSimResources",
        "count": "[length(parameters('simResources'))]"
      },
      "type": "Microsoft.MobileNetwork/simGroups/sims",
      "apiVersion": "2024-02-01",
      "name": "[format('{0}/{1}', parameters('simGroupName'), parameters('simResources')[copyIndex()].simName)]",
      "properties": {
        "integratedCircuitCardIdentifier": "[parameters('simResources')[copyIndex()].integratedCircuitCardIdentifier]",
        "internationalMobileSubscriberIdentity": "[parameters('simResources')[copyIndex()].internationalMobileSubscriberIdentity]",
        "authenticationKey": "[parameters('simResources')[copyIndex()].authenticationKey]",
        "operatorKeyCode": "[parameters('simResources')[copyIndex()].operatorKeyCode]",
        "deviceType": "[parameters('simResources')[copyIndex()].deviceType]",
        "simPolicy": {
          "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks/simPolicies', parameters('existingMobileNetworkName'), parameters('existingSimPolicyName'))]"
        }
      },
      "dependsOn": [
        "[resourceId('Microsoft.MobileNetwork/simGroups', parameters('simGroupName'))]"
      ]
    },
    {
      "type": "Microsoft.MobileNetwork/simGroups",
      "apiVersion": "2024-02-01",
      "name": "[parameters('simGroupName')]",
      "location": "[parameters('location')]",
      "properties": {
        "mobileNetwork": {
          "id": "[resourceId('Microsoft.MobileNetwork/mobileNetworks', parameters('existingMobileNetworkName'))]"
        },
        "encryptionKey": {
          "keyUrl": "[parameters('existingEncryptionKeyUrl')]"
        }
      },
      "identity": "[if(not(empty(parameters('existingUserAssignedIdentityResourceId'))), createObject('type', 'UserAssigned', 'userAssignedIdentities', createObject(format('{0}', parameters('existingUserAssignedIdentityResourceId')), createObject())), createObject('type', 'None'))]"
    }
  ]
}

该模板中定义了以下 Azure 资源。

部署模板

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

    用于将资源管理器模板部署到 Azure 的按钮。

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

    • 订阅:选择在创建专用移动网络时使用的 Azure 订阅
    • 资源组:选择包含代表该专用移动网络的移动网络资源的资源组
    • 区域:选择你部署专用移动网络的区域。
    • 位置:输入你部署专用移动网络的区域的代码名称
    • 现有移动网络名称:输入代表该专用移动网络的移动网络资源的名称
    • 现有 Sim 策略名称:输入要分配给 SIM 的 SIM 策略的名称。
    • Sim 组名称:输入新 SIM 组的名称。
    • Sim 资源:粘贴在你在为 SIM 准备一个或多个 JSON 数组中准备的一个 JSON 数组中。

    Azure 门户的屏幕截图,其中显示 SIM ARM 模板的配置字段。

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

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

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

  5. 验证配置后,可以选择“创建”以预配 SIM。 预配 SIM 后,Azure 门户将显示确认屏幕。

  6. 如果要预配超过 1000 个 SIM,请为每个 JSON 数组重复此过程。

查看已部署的资源

  1. 选择“转到资源组”。

    Azure 门户的屏幕截图,其中显示了 ARM 模板的部署确认。

  2. 确认是否已在资源组中创建 SIM 组资源。

    Azure 门户的屏幕截图,其中显示包含新创建的 SIM 组的资源组。

  3. 选择 SIM 组资源,并确认是否已正确预配所有 SIM。

    Azure 门户的屏幕截图,其中显示包含 SIM 的 SIM 组资源。

后续步骤