為 Azure 私人 5G 核心版布建新的 SIM - ARM 範本

SIM 資源 代表私人行動網路所使用使用者設備所使用的實體 SIM 或 eSIM。 在本操作指南中,您將瞭解如何使用 Azure Resource Manager 範本(ARM 範本)為現有的私人行動網路布建新的 SIM。

Azure Resource Manager 範本是 JavaScript 物件表示法 (JSON) 檔案,可定義專案的基礎結構和組態。 範本使用宣告式語法。 您不需要撰寫程式設計命令順序來建立部署,即可描述預定的部署。

如果您的環境符合必要條件,而且您很熟悉 ARM 範本,請選取 [部署至 Azure] 按鈕。 範本會在 Azure 入口網站中開啟。

將 Resource Manager 範本部署至 Azure 的按鈕。

必要條件

  • 請確定您可以使用帳戶來登入 Azure 入口網站,並存取您在完成部署私人行動網路的必要條件工作中所識別的作用中訂用帳戶。 此帳戶必須具有訂用帳戶範圍的內建參與者角色。
  • 識別對應至私人行動網路及其資源群組的行動網路資源名稱。
  • 識別您已部署私人行動網路的 Azure 區域。
  • 為要新增 SIM 的新 SIM 群組選擇名稱。
  • 識別您要指派給您要布建之 SIM 的 SIM 原則。 您必須已使用設定 SIM 原則 - Azure 入口網站 中的指示來建立此 SIM 卡原則。

收集 SIM 的必要資訊

若要開始,請針對您想要布建的每個 SIM 卡收集下表中的值。

參數名稱
SIM 名稱。 SIM 名稱只能包含英數位元、連字元和底線。 simName
積體電路卡標識碼(ICCID)。 ICCID 會識別特定的實體 SIM 卡或 eSIM,並包含 SIM 卡國家/地區和簽發者的相關信息。 ICCID 是選擇性的,從 89 開始,是長度介於 19 到 20 位數之間的唯一數值。 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。
  • 您已為封包核心實例設定靜態 IP 位址配置。
  • 您想要在 SIM 佈建期間將靜態 IP 位址指派給 SIM。

針對您想要布建的每個 SIM 卡收集下表中的值。 如果您的私人行動網路有多個數據網路,而且您想要為每個數據網路指派不同的靜態 IP 位址給此 SIM 卡,請收集每個 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,請建立多個數位列,並針對每個 VM 重複布建程式。 或者,您可以使用 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 並開啟範本。

    將 Resource Manager 範本部署至 Azure 的按鈕。

  2. 使用您在必要條件中擷取的信息,選取或輸入下列值。

    • 訂用帳戶: 選取您用來建立私人行動網路的 Azure 訂用帳戶。
    • 資源群組: 選取包含代表私人行動網路之行動網路資源的資源群組。
    • 區域: 選取您已部署私人行動網路的區域。
    • 位置: 輸入 您已部署私人行動網路之區域的代碼名稱
    • 現有的行動網路名稱: 輸入代表私人行動網路的行動網路資源名稱。
    • 現有的 Sim 原則名稱: 輸入您要指派給 SIM 的 SIM 原則名稱。
    • Sim 組名: 輸入新 SIM 卡群組的名稱。
    • Sim 資源:貼上您在為 SIM 準備一或多個 JSON 陣列中準備的其中一個 JSON 陣列。

    Azure 入口網站 螢幕快照,其中顯示 SIM ARM 範本的設定欄位。

  3. 選取 [檢閱 + 建立]。

  4. 現在 Azure 會驗證您輸入的設定值。 您應該會看到指出您的值已通過驗證的訊息。

    如果驗證失敗,您會看到錯誤訊息,且將標示包含無效組態的 [組態] 索引標籤。 選取標幟的索引標籤,並使用錯誤訊息更正無效的設定,再返回 [ 檢閱 + 建立 ] 索引標籤。

  5. 驗證設定之後,您可以選取 [建立] 來布建您的 SIM。 Azure 入口網站 會在布建 SIM 時顯示確認畫面。

  6. 如果您要佈建超過 1000 個 SIM,請針對每個 JSON 陣列重複此程式。

檢閱已部署的資源

  1. 選取 [移至資源群組]。

    Azure 入口網站 螢幕快照,其中顯示ARM範本的部署確認。

  2. 確認 已在資源群組中建立 SIM 群組 資源。

    Azure 入口網站 螢幕快照,其中顯示包含新建立 SIM 群組的資源群組。

  3. 選取 SIM 群組資源,並確認已正確布建所有 SIM。

    Azure 入口網站 螢幕快照,其中顯示包含 SIM 的 SIM 群組資源。

下一步