从 Azure 资源组模板部署市场连接器

Deploying a marketplace Connector from Azure Resource Group template

我正在使用 Visual studio 中的 Azure 资源组项目模板来部署两个 API 应用程序和一个逻辑应用程序。我希望其中一个 API 应用程序成为来自市场的 Blob 连接器。我需要的是连接器的 .zip 包的 uri,如下所示:

{
      "apiVersion": "2014-06-01",
      "name": "MSDeploy",
      "type": "Extensions",
      "dependsOn": [
            //........
      ],
      "properties": {
        "packageUri": "https://auxmktplceprod.blob.core.windows.net/packages/UmbracoCms.WebPI.7.2.5.zip",
        "dbType": "SQL",

(source)
我尝试了 解决方案,但该 cmdlet 现已弃用。有什么方法可以获取这些 URI 吗?

-谢谢!

我找到了一种使用 Marketplace 应用程序部署自定义 api 应用程序的方法。

下面是一个示例脚本,仅供您参考

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "blobConnectorName": {
            "type": "string",
            "minLength": 1,
            "defaultValue" : "mytestblobconnector"
        },
        "blobStorageAccount": {
            "type": "string",
            "minLength": 1,
            "defaultValue" : "mystorage.blob.core.windows.net"
        },
        "blobStorageKey": {
            "type": "securestring",
            "minLength": 1,
            "defaultValue" : "storgekey"
        },
        "blobContainerName": {
            "type": "string",
            "minLength": 1,
            "defaultValue" : "mycontainer"
        },
        "gatewayName": {
            "type": "string",
            "minLength": 1,
            "defaultValue" : "myblobconnectorgateway"
        },
        "logicAppName": {
            "type": "string",
            "minLength": 1,
            "defaultValue" : "testinglogicapp"
        },
        "svcPlanName": {
            "type": "string",
            "minLength": 1,
            "defaultValue" : "myresourcegrpserviceplan"
        },
        "sku": {
            "type": "string",
            "defaultValue": "Basic",
            "allowedValues": [
                "Free",
                "Basic",
                "Standard",
                "Premium"
            ]
        },
        "svcPlanSize": {
            "defaultValue": "0",
            "type": "string",
            "allowedValues": [
                "0",
                "1",
                "2"
            ]
        },
        "gatewayToApiAppSecret": {
            "defaultValue": "0000000000000000000000000000000000000000000000000000000000000000",
            "type": "securestring"
        }
    },
    "variables": {
        "$packageId": "Microsoft.ApiApp",
        "$nugetFeed": "http://apiapps-preview.nuget.org/api/v2/"
    },
    "resources": [
        {
            "type": "Microsoft.Web/serverfarms",
            "apiVersion": "2015-04-01",
            "name": "[parameters('svcPlanName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "AppServicePlan"
            },
            "properties": {
                "name": "[parameters('svcPlanName')]",
                "sku": "[parameters('sku')]",
                "workerSize": "[parameters('svcPlanSize')]",
                "numberOfWorkers": 1
            }
        },
        {
            "type": "Microsoft.Web/sites",
            "apiVersion": "2015-04-01",
            "name": "[parameters('gatewayName')]",
            "location": "[resourceGroup().location]",
            "kind": "gateway",
            "tags": {
                "displayName": "GatewayHost"
            },
            "resources": [
                {
                    "type": "providers/links",
                    "apiVersion": "2015-01-01",
                    "name": "Microsoft.Resources/gateway",
                    "dependsOn": [
                        "[resourceId('Microsoft.Web/sites', parameters('gatewayName'))]"
                    ],
                    "properties": {
                        "targetId": "[resourceId('Microsoft.AppService/gateways', parameters('gatewayName'))]"
                    }
                }
            ],
            "dependsOn": [
                "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('svcPlanName'))]"
            ],
            "properties": {
                "name": "[parameters('gatewayName')]",
                "gatewaySiteName": "[parameters('gatewayName')]",
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('svcPlanName'))]",
                "siteConfig": {
                    "appSettings": [
                        {
                            "name": "ApiAppsGateway_EXTENSION_VERSION",
                            "value": "latest"
                        },
                        {
                            "name": "EmaStorage",
                            "value": "D:\home\data\apiapps"
                        },
                        {
                            "name": "WEBSITE_START_SCM_ON_SITE_CREATION",
                            "value": "1"
                        }
                    ]
                }
            }
        },
        {
            "type": "Microsoft.AppService/gateways",
            "apiVersion": "2015-03-01-preview",
            "name": "[parameters('gatewayName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "Gateway"
            },
            "resources": [
                {
                    "type": "providers/links",
                    "apiVersion": "2015-01-01",
                    "name": "Microsoft.Resources/gatewaySite",
                    "dependsOn": [
                        "[resourceId('Microsoft.AppService/gateways', parameters('gatewayName'))]"
                    ],
                    "properties": {
                        "targetId": "[resourceId('Microsoft.Web/sites', parameters('gatewayName'))]"
                    }
                },
                {
                    "type": "tokens",
                    "apiVersion": "2015-03-01-preview",
                    "location": "[resourceGroup().location]",
                    "name": "[parameters('logicAppName')]",
                    "tags": {
                        "displayName": "AuthenticationToken"
                    },
                    "dependsOn": [
                        "[resourceId('Microsoft.AppService/gateways', parameters('gatewayName'))]"
                    ]
                }
            ],
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('gatewayName'))]"
            ],
            "properties": {
                "host": {
                    "resourceName": "[parameters('gatewayName')]"
                }
            }
        },
        {
            "type": "Microsoft.Web/sites",
            "apiVersion": "2015-04-01",
            "name": "[parameters('blobConnectorName')]",
            "location": "[resourceGroup().location]",
            "kind": "apiApp",
            "tags": {
                "displayName": "APIAppHost",
                "packageId": "AzureStorageBlobConnector"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', parameters('svcPlanName'))]",
                "[resourceId('Microsoft.AppService/gateways', parameters('gatewayName'))]"
            ],
            "resources": [
                {
                    "type": "siteextensions",
                    "tags": {
                        "displayName": "APIAppExtension"
                    },
                    "apiVersion": "2015-02-01",
                    "name": "AzureStorageBlobConnector",
                    "dependsOn": [
                        "[resourceId('Microsoft.Web/sites', parameters('blobConnectorName'))]"
                    ],
                    "properties": {
                        "type": "WebRoot",
                        "feed_url": "[variables('$nugetFeed')]"
                    }
                },
                {
                    "type": "providers/links",
                    "apiVersion": "2015-01-01",
                    "name": "Microsoft.Resources/apiApp",
                    "dependsOn": [
                        "[resourceId('Microsoft.Web/sites', parameters('blobConnectorName'))]"
                    ],
                    "properties": {
                        "targetId": "[resourceId('Microsoft.AppService/apiapps', parameters('blobConnectorName'))]"
                    }
                }
            ],
            "properties": {
                "gatewaySiteName": "[parameters('gatewayName')]",
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('svcPlanName'))]",
                "siteConfig": {
                    "appSettings": [
                        {
                            "name": "EMA_MicroserviceId",
                            "value": "[parameters('blobConnectorName')]"
                        },
                        {
                            "name": "EMA_Secret",
                            "value": "[parameters('gatewayToAPIappSecret')]"
                        },
                        {
                            "name": "EMA_RuntimeUrl",
                            "value": "[concat('https://', reference(resourceId('Microsoft.Web/sites', parameters('gatewayName'))).hostNames[0])]"
                        },
                        {
                            "name": "WEBSITE_START_SCM_ON_SITE_CREATION",
                            "value": "1"
                        },
                        {
                            "name": "BlobConnector_ContainerUrl",
                            "value": "[concat('https://', parameters('blobStorageAccount'),'/',parameters('blobContainerName'))]"
                        },
                        {
                            "name": "BlobConnector_AccessKey",
                            "value": "[parameters('blobStorageKey')]"
                        }
                    ],
                    "applicationLogs": {
                        "filesystem": {
                            "level": "Verbose"
                        },
                        "azureTableStorage": {
                            "level": "Off",
                            "sasUrl": null
                        },
                        "azureBlobStorage": {
                            "level": "Off",
                            "sasUrl": null,
                            "retentionInDays": null
                        }
                    }
                }
            }
        },
        {
            "type": "Microsoft.AppService/apiapps",
            "apiVersion": "2015-03-01-preview",
            "name": "[parameters('blobConnectorName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "BlobConnector"
            },
            "resources": [
                {
                    "type": "providers/links",
                    "apiVersion": "2015-01-01",
                    "name": "Microsoft.Resources/apiAppSite",
                    "dependsOn": [
                        "[resourceId('Microsoft.AppService/apiapps', parameters('blobConnectorName'))]"
                    ],
                    "properties": {
                        "targetId": "[resourceId('Microsoft.Web/sites', parameters('blobConnectorName'))]"
                    }
                }
            ],
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites/siteextensions', parameters('blobConnectorName'), 'AzureStorageBlobConnector')]"
            ],
            "properties": {
                "package": {
                    "id": "AzureStorageBlobConnector"
                },
                "host": {
                    "resourceName": "[parameters('blobConnectorName')]"
                },
                "gateway": {
                    "resourceName": "[parameters('gatewayName')]"
                },
                "dependencies": [ ]
            }
        },
        {
            "type": "Microsoft.Logic/workflows",
            "apiVersion": "2015-02-01-preview",
            "name": "[parameters('logicAppName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "LogicApp"
            },
            "dependsOn": [
                "[resourceId('Microsoft.AppService/apiApps', parameters('blobConnectorName'))]"
            ],
            "properties": {
                "sku": {
                    "name": "[parameters('sku')]",
                    "plan": {
                        "id": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/',parameters('svcPlanName'))]"
                    }
                },
                "definition": {
                    "$schema": "http://schema.management.azure.com/providers/Microsoft.Logic/schemas/2014-12-01-preview/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {
                        "token": {
                            "defaultValue": "[reference(resourceId('Microsoft.AppService/gateways/tokens', parameters('gatewayName'), parameters('logicAppName'))).token]",
                            "type": "String",
                            "metadata": {
                                "token": {
                                    "name": "token"
                                }
                            }
                        },
                        "runworkflowmanually": {
                            "defaultValue": true,
                            "type": "Bool"
                        }
                    },
                    "triggers": { },
                    "actions": {
                        "azurestorageblobconnector": {
                            "type": "ApiApp",
                            "inputs": {
                                "apiVersion": "2015-01-14",
                                "host": {
                                    "id": "[concat(resourceGroup().id, '/providers/Microsoft.AppService/apiApps/',parameters('blobConnectorName'))]",
                                    "gateway": "[concat('https://', reference(resourceId('Microsoft.Web/sites', parameters('gatewayName'))).hostNames[0])]"
                                },
                                "operation": "UploadBlob",
                                "parameters": {
                                    "BlobPath": "myfolder/test.txt",
                                    "BlobContent": {
                                        "Content": "TestMessage",
                                        "ContentTransferEncoding": "None"
                                    },
                                    "Overwrite": true
                                },
                                "authentication": {
                                    "type": "Raw",
                                    "scheme": "Zumo",
                                    "parameter": "@parameters('token')"
                                }
                            },
                            "conditions": [ ]
                        }
                    },
                    "outputs": {
                    }
                },
                "parameters": { }
            }
        }
    ]
}

只需在上面的 json 中搜索 "AzureStorageBlobConnector" 即可观察使用情况,即来自市场的 blob 连接器的包 ID。我通过手动部署然后检查其设置从 Azure 门户找到了 blob 连接器的包 ID。如果您遇到任何困难,请随时 post 评论其他市场应用程序的包 ID。