使用自定义提供程序创建的Azure资源未显示在Azure门户上

nue99wik  于 2022-11-30  发布在  其他
关注(0)|答案(1)|浏览(126)

我通过以下链接中的文档创建了Azure自定义提供程序:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/custom-providers/
我可以使用ARM模板成功创建自定义提供程序中定义的类型的资源。但是,我在Azure门户上的特定资源组下看不到这些资源。
这是预期的行为吗?

bvk5enib

bvk5enib1#

  • 我已经通过以下步骤使用ARM模板在Azure Portal中部署了自定义提供程序
  • 打开Azure门户并搜索自定义部署,如下所示

  • 取自Microsoft Doc的参考
  • 打开自定义部署后,我使用了下面的代码,然后单击保存
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
        "funcName": {
            "type": "string",
      "defaultValue": "[uniqueString(resourceGroup().id)]",
      "metadata": {
                "description": "The unique name of the function application"
      }
        },
    "storageName": {
            "type": "string",
      "defaultValue": "[concat('store', uniquestring(resourceGroup().id))]",
      "metadata": {
                "description": "The unique name of the storage account."
      }
        },
    "location": {
            "type": "string",
      "defaultValue": "eastus",
      "metadata": {
                "description": "The location for the resources."
      }
        },
    "zipFileBlobUri": {
            "type": "string",
      "defaultValue": "https://github.com/Azure/azure-docs-json-samples/blob/master/custom-providers/_artifacts/functionpackage.zip?raw=true",
      "metadata": {
                "description": "The URI to the uploaded function zip file"
      }
        }
    },
  "resources": [
    {
        "type": "Microsoft.Web/sites",
      "apiVersion": "2022-03-01",
      "name": "[parameters('funcName')]",
      "location": "[parameters('location')]",
      "kind": "functionapp",
      "identity": {
            "type": "SystemAssigned"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageName'))]"
      ],
      "properties": {
            "name": "[parameters('funcName')]",
        "siteConfig": {
                "appSettings": [
                  {
                    "name": "AzureWebJobsDashboard",
              "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2022-05-01').keys[0].value)]"
                  },
            {
                    "name": "AzureWebJobsStorage",
              "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2022-05-01').keys[0].value)]"
            },
            {
                    "name": "FUNCTIONS_EXTENSION_VERSION",
              "value": "~2"
            },
            {
                    "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
              "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2022-05-01').keys[0].value)]"
            },
            {
                    "name": "WEBSITE_CONTENTSHARE",
              "value": "[toLower(parameters('funcName'))]"
            },
            {
                    "name": "WEBSITE_NODE_DEFAULT_VERSION",
              "value": "6.5.0"
            },
            {
                    "name": "WEBSITE_RUN_FROM_PACKAGE",
              "value": "[parameters('zipFileBlobUri')]"
            }
          ]
        },
        "clientAffinityEnabled": false,
        "reserved": false
      }
    },
    {
        "type": "Microsoft.Storage/storageAccounts",
      "apiVersion": "2022-05-01",
      "name": "[parameters('storageName')]",
      "location": "[parameters('location')]",
      "kind": "StorageV2",
      "sku": {
            "name": "Standard_LRS"
      }
    },
    {
        "type": "Microsoft.CustomProviders/resourceProviders",
      "apiVersion": "2018-09-01-preview",
      "name": "[parameters('funcName')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Web/sites/',parameters('funcName'))]"
      ],
      "properties": {
            "actions": [
              {
                "name": "ping",
            "routingType": "Proxy",
            "endpoint": "[concat('https://', parameters('funcName'), '.azurewebsites.net/api/{requestPath}')]"
              }
        ],
        "resourceTypes": [
          {
                "name": "users",
            "routingType": "Proxy,Cache",
            "endpoint": "[concat('https://', parameters('funcName'), '.azurewebsites.net/api/{requestPath}')]"
          }
        ]
      }
    },
    {
        "type": "Microsoft.CustomProviders/resourceProviders/users",
      "apiVersion": "2018-09-01-preview",
      "name": "[concat(parameters('funcName'), '/ana')]",
      "location": "parameters('location')",
      "dependsOn": [
        "[concat('Microsoft.CustomProviders/resourceProviders/',parameters('funcName'))]"
      ],
      "properties": {
            "FullName": "Ana Bowman",
        "Location": "Moon"
      }
    }
  ],
  "outputs": {
        "principalId": {
            "type": "string",
      "value": "[reference(concat('Microsoft.Web/sites/', parameters('funcName')), '2022-03-01', 'Full').identity.principalId]"
        }
    }
}
  • 填写以下详细信息,如订阅ID资源组位置,然后单击查看+创建

  • 部署到蔚蓝色的传送门后,我们将到达下面

  • 将其部署到azure poral后,转到azure门户,单击您的资源组,然后单击复选框,您将看到如下所示

相关问题