I am attempting to invoke a Custom Provider from a Managed App in a "Hello World", proof of concept, Managed Application. I attempted using the following Microsoft document, however the function app does not seem to work and the deployment fails in Azure when deploying, so I am attempting to make my own.
My resource provider is defined in the mainTemplate.json of my Managed App deployment and once deployed I can retrieve the following definition from REST GET request. When I invoke the resource provider from Azure CLI I get a response from the referenced function app as I would expect.
{
"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": {}
}
I have created two buttons in my viewDefinition.json. Here is the entire file.
{
"$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": { }
}
}
]
}
When I deploy the Managed App and click the button on the overview page I get the following error.
Failed running command 'Click' in 'managedAppTest'. Error: The resource provider 'public' did not find a valid route definition for 'public/product/GetDocumentation'. Please ensure the route exists and is correctly configured.