发布到Marketplace的Azure托管应用程序无法向自定义提供商发布请求(由于招摇过市而被阻止?)
我有一个托管应用程序,其中包含一个按钮,用于调用对底层自定义资源提供程序的POST请求。我已经使用订阅中的服务目录部署了这个托管应用程序,它可以正常工作。但是,当我将托管应用程序发布到Azure Marketplace并提交时,它需要一个通过github原始URI托管和链接的招摇过市定义 json格式的我的招摇过市定义:发布到Marketplace的Azure托管应用程序无法向自定义提供商发布请求(由于招摇过市而被阻止?),azure,swagger,openapi,azure-managed-app,Azure,Swagger,Openapi,Azure Managed App,我有一个托管应用程序,其中包含一个按钮,用于调用对底层自定义资源提供程序的POST请求。我已经使用订阅中的服务目录部署了这个托管应用程序,它可以正常工作。但是,当我将托管应用程序发布到Azure Marketplace并提交时,它需要一个通过github原始URI托管和链接的招摇过市定义 json格式的我的招摇过市定义: { "swagger": "2.0", "info": { "ti
{
"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在发布时接受并验证此招摇过市定义,但是,当我通过Marketplace部署托管应用程序并单击按钮时,会出现错误
错误消息显示“请检查swagger验证是否有此操作的定义路由。”
以下是自定义资源提供程序中的路径定义
{
"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'))]"
]
}
]
}
当我提供了在发布过程中验证的招摇过市定义文档时,为什么在Marketplace部署的应用程序中单击Transition Account按钮时会收到错误
编辑:活动日志中的错误如下。
从活动日志中提取的错误如下。{“error”:{“code”:“missingsawagger”,“message”:“找不到具有方法“POST”的请求“/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/mrg-xxxxxx-managed-appli-20210526184240/providers/Microsoft.CustomProviders/resourceProviders/public/transitionAccount”的有效swagger定义。请检查swagger验证是否具有此操作的定义路由。”}该问题与swagger比较的大小写敏感性质有关。在使用大小写更改更新swagger文件后,您需要重新创建自定义rp。原因是我们在创建自定义提供程序资源期间缓存了swagger文件,并且不知道发生了更新
但目前,我们刚刚完成了一项部署,使招摇过市成为市场产品的可选配置。请在不指定“验证”部分的情况下重试您的部署,这样应该可以开始正常工作。最近我尝试将“TransitionAccount”修改为“TransitionAccount”“在大摇大摆的人群中。我还尝试将招摇过市的文档合并成一个文档。这两种方法似乎都没有影响到当前的问题。我大摇大摆地匹配了这个案例,并重新部署了RP,但没有成功。我很高兴这个需求被删除了,但是如果它能正常工作,那将是一个很好的验证。验证仍然存在。这不是强制性的。我们有一个bug,它实际上没有得到服务目录的验证,并且已经修复了这个bug。虽然我很好奇。我在5月27日之后的服务中没有看到任何对“transitionAccount”的调用。您确定在重新发布应用程序并在进行修改后重新部署应用程序后,您会收到相同的错误吗。我认为这相当于重新投入。如果是这样的话,你的问题的答案是“是”。目前,我们已经从mainTemplate.json中删除了验证。我很高兴把它们放回去重新测试。或者直接打电话给你,向你展示我的经验。是的,我上一次测试transitionAccount是在5月27日。但是我在做了你上面推荐的所有更新后进行了测试(大摇大摆地修改外壳、重新创建RP以及重新发布到市场)。此准确响应是在5月25日通过支持票证推荐的,并在重新部署应用程序后于5月27日尝试。