我正在尝试从“Hello World”、概念证明、托管应用程序中的托管应用程序调用自定义提供程序。我尝试使用以下Microsoft 文档,但功能应用程序似乎无法正常工作,并且在部署时在 Azure 中部署失败,因此我正在尝试自己制作。
我的资源提供程序在我的托管应用程序部署的 mainTemplate.json 中定义,部署后我可以从 REST GET 请求中检索以下定义。当我从 Azure CLI 调用资源提供程序时,我从引用的函数应用程序中得到了我所期望的响应。
{
"properties": {
"actions": [
{
"name": "public/product/GetDocumentation",
"routingType": "Proxy",
"endpoint": "https://faraveXXXX.azurewebsites.net/api/{requestPath}"
}
],
"provisioningState": "Succeeded"
},
"id": "/subscriptions/XXXXXXXX-995e-4e82-a86e-499522a63304/resourceGroups/mrg-Rob-20210311141704/providers/Microsoft.CustomProviders/resourceproviders/public",
"name": "public",
"type": "Microsoft.CustomProviders/resourceproviders",
"location": "eastus",
"tags": {}
}
我在 viewDefinition.json 中创建了两个按钮。这是整个文件。
{
"$schema": "https://schema.management.azure.com/schemas/viewdefinition/0.0.1-preview/ViewDefinition.json#",
"contentVersion": "0.0.0.1",
"views": [
{
"kind": "Overview",
"properties": {
"header": "TitleHeader",
"description": "TitleHeaderDescription",
"commands": [
{
"displayName": "Click",
"path": "public/product/GetDocumentation",
"icon": "Check"
}
]
}
},
{
"kind": "Metrics",
"properties": {
"displayName": "This is my metrics view",
"version": "1.0.0",
"charts": [
{
"displayName": "Sample chart",
"chartType": "Bar",
"metrics": [
{
"name": "Availability",
"aggregationType": "avg",
"resourceTagFilter": [ "tag1" ],
"resourceType": "Microsoft.Storage/storageAccounts",
"namespace": "Microsoft.Storage/storageAccounts"
}
]
}
]
}
},
{
"kind": "CustomResources",
"properties": {
"displayName": "Test custom resource type",
"version": "1.0.0",
"resourceType": "public",
"createUIDefinition": { },
"commands": [
{
"displayName": "Custom Context Action",
"path": "public/product/GetDocumentation",
"icon": "Stop",
"createUIDefinition": { }
}
],
"columns": [
{"key": "name", "displayName": "Name"},
{"key": "properties.myProperty1", "displayName": "Property 1"},
{"key": "properties.myProperty2", "displayName": "Property 2", "optional": true}
]
}
},
{
"kind": "Associations",
"properties": {
"displayName": "Test association resource type",
"version": "1.0.0",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"createUIDefinition": { }
}
}
]
}
当我部署托管应用程序并单击概览页面上的按钮时,我收到以下错误。
在“managedAppTest”中运行命令“Click”失败。错误:资源提供者“public”没有找到“public/product/GetDocumentation”的有效路由定义。请确保路由存在且配置正确。