I have a managed application that contains a button which invokes a POST request to the underlying custom resource provider. I have deployed this managed application using the service catalog from within the subscription and it works. However, when I publish the managed application to the Azure Marketplace and submit, it requires a swagger definition to be hosted and linkable through a github raw URI.
My swagger definition in json format:
{
"swagger": "2.0",
"info": {
"title": "Azure Functions Open API Extension",
"version": "2018-09-01-preview"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"security": [
{}
],
"securityDefinitions": {},
"paths": {
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{minirpname}/TransitionAccount": {
"post": {
"tags": [
"PostTransitionAccount"
],
"operationId": "PostTransitionAccount",
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "api-version",
"description": "api-version is required. Valid versions are 2018-09-01-preview",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "subscriptionId",
"description": "This is the Id of the subscription",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "resourceGroupName",
"description": "This is the resource group name where the managed app is deployed",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "minirpname",
"description": "This is the resource provider name",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "The OK response",
"schema": {}
},
"500": {
"description": "The InternalServerError response",
"schema": {}
}
}
}
}
},
"parameters": {
"ApiVersionParameter": {
"name": "api-version",
"in": "query",
"required": true,
"type": "string",
"description": "Client Api Version."
}
}
}
Marketplace takes and validates this swagger definition upon publishing, however when I deploy the managed app through Marketplace and click the button I get an error.
The error message says "Please check that the swagger validations have a defined route for this operation."
Here is the path definition in my custom resource provider.
{
"apiVersion": "[variables('customrpApiversion')]",
"type": "Microsoft.CustomProviders/resourceProviders",
"name": "[parameters('providerName')]",
"location": "[parameters('location')]",
"properties": {
"actions": [
{
"name": "transitionAccount",
"routingType": "Proxy",
"endpoint": "[concat('https://', variables('funcname'), '.azurewebsites.net/api/{requestPath}')]"
}
],
"resourceTypes": [
{
"name": "accountType",
"routingType": "Proxy,Cache",
"endpoint": "[concat('https://', variables('funcname'), '.azurewebsites.net/api/{requestPath}')]"
}
],
"Validations" :[
{
"ValidationType": "swagger",
"Specification": "https://raw.githubusercontent.com/cleardataeng/azure-shared-image-gallery-syncer/master/metadata/account-type-swagger.json"
},
{
"ValidationType": "swagger",
"Specification": "https://raw.githubusercontent.com/cleardataeng/azure-shared-image-gallery-syncer/master/metadata/transition-account-swagger.json"
}
]
},
"dependsOn": [
"[concat('Microsoft.Web/sites/',variables('funcname'))]"
],
"resources": [
{
"type": "accountType",
"name": "current",
"apiVersion": "[variables('customrpApiversion')]",
"location": "[parameters('location')]",
"properties": {
"displayName": "[subscription().displayName]",
"tenantId": "[subscription().tenantId]",
"subscriptionId": "[subscription().subscriptionId]",
"accountType": "Evaluation",
"accountTypeStatus": "Pending"
},
"dependsOn": [
"[concat('Microsoft.CustomProviders/resourceProviders/',parameters('providerName'))]"
]
}
]
}
Why am I receiving an error clicking the Transition Account button in the Marketplace deployed application when I have provided the swagger definition document which was validated during publish?
Edit: The error from activity log is the following. The error extracted from activity log is the following. {"error":{"code":"MissingSwagger","message":"Could not find a valid swagger definition for request '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/mrg-xxxxxx-managed-appli-20210526184240/providers/Microsoft.CustomProviders/resourceProviders/public/transitionAccount' with method 'POST'. Please check that the swagger validations have a defined route for this operation."}}