Azure - 使用 arm 模板从 Visual Studio 部署 Web 应用程序,连接到 VSTS git 源代码控制 [英] Azure - deploy web app from visual studio using arm template, connected to VSTS git source control

查看:34
本文介绍了Azure - 使用 arm 模板从 Visual Studio 部署 Web 应用程序,连接到 VSTS git 源代码控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 arm 模板从 Visual Studio 部署 azure web 应用程序(应用程序服务).

I am trying to deploy azure web app (app services) from visual studio using arm template.

这些是来自模板的资源:

These are resources from template:

"resources": [
      {
        "type": "Microsoft.Web/sites",
        "kind": "app",
        "name": "[parameters('site_name')]",
        "apiVersion": "2016-08-01",
        "location": "North Europe",       
        "scale": null,
        "properties": {
          "enabled": true,
          "hostNameSslStates": [
            {
              "name": "[concat(parameters('site_name'),'.azurewebsites.net')]",
              "sslState": "Disabled",
              "virtualIP": null,
              "thumbprint": null,
              "toUpdate": null,
              "hostType": "Standard"
            },
            {
              "name": "[concat(parameters('site_name'),'.scm.azurewebsites.net')]",
              "sslState": "Disabled",
              "virtualIP": null,
              "thumbprint": null,
              "toUpdate": null,
              "hostType": "Repository"
            }
          ],
          "serverFarmId": "[parameters('site_serverFarmId')]",
          "reserved": false,
          "siteConfig": null,
          "scmSiteAlsoStopped": false,
          "hostingEnvironmentProfile": null,
          "clientAffinityEnabled": true,
          "clientCertEnabled": false,
          "hostNamesDisabled": false,
          "containerSize": 0,
          "dailyMemoryTimeQuota": 0,
          "cloningInfo": null
        },
        "resources": [
          {
            "apiVersion": "2016-08-01",
            "name": "web",
            "type": "sourcecontrols",        
            "dependsOn": [
              "[resourceId('Microsoft.Web/Sites', parameters('site_name'))]"
            ],            
            "properties": {
              "repoUrl": "https://...",
              "branch": "master",
              "isManualIntegration": false              
            }
          }
        ],
        "dependsOn": []
      },
      {

            "type": "Microsoft.Web/sites/config",
            "name": "[parameters('config_web_name')]",
            "apiVersion": "2016-08-01",
            "location": "North Europe",

            "scale": null,
            "properties": {
                "numberOfWorkers": 1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php",
                    "hostingstart.html"
                ],
                "netFrameworkVersion": "v4.0",
                "phpVersion": "5.6",
                "pythonVersion": "",
                "nodeVersion": "",
                "linuxFxVersion": "",
                "requestTracingEnabled": false,
                "remoteDebuggingEnabled": false,
                "remoteDebuggingVersion": null,
                "httpLoggingEnabled": false,
                "logsDirectorySizeLimit": 35,
                "detailedErrorLoggingEnabled": false,
                "publishingUsername": "[concat('$',parameters('site_name'))]",
                "publishingPassword": null,
                "appSettings": null,
                "metadata": null,
                "connectionStrings": null,
                "machineKey": null,
                "handlerMappings": null,
                "documentRoot": null,
                "scmType": "VSO",
                "use32BitWorkerProcess": true,
                "webSocketsEnabled": false,
                "alwaysOn": false,
                "javaVersion": null,
                "javaContainer": null,
                "javaContainerVersion": null,
                "appCommandLine": "",
                "managedPipelineMode": "Integrated",
                "virtualApplications": [
                    {
                        "virtualPath": "/",
                        "physicalPath": "site\\wwwroot",
                        "preloadEnabled": false,
                        "virtualDirectories": null
                    }
                ],
                "winAuthAdminState": 0,
                "winAuthTenantState": 0,
                "customAppPoolIdentityAdminState": true,
                "customAppPoolIdentityTenantState": false,
                "runtimeADUser": null,
                "runtimeADUserPassword": null,
                "loadBalancing": "LeastRequests",
                "routingRules": [],
                "experiments": {
                    "rampUpRules": []
                },
                "limits": null,
                "autoHealEnabled": false,
                "autoHealRules": {
                    "triggers": null,
                    "actions": null
                },
                "tracingOptions": null,
                "vnetName": "",
                "siteAuthEnabled": false,
                "siteAuthSettings": {
                    "enabled": null,
                    "unauthenticatedClientAction": null,
                    "tokenStoreEnabled": null,
                    "allowedExternalRedirectUrls": null,
                    "defaultProvider": null,
                    "clientId": null,
                    "clientSecret": null,
                    "issuer": null,
                    "allowedAudiences": null,
                    "additionalLoginParams": null,
                    "isAadAutoProvisioned": false,
                    "googleClientId": null,
                    "googleClientSecret": null,
                    "googleOAuthScopes": null,
                    "facebookAppId": null,
                    "facebookAppSecret": null,
                    "facebookOAuthScopes": null,
                    "twitterConsumerKey": null,
                    "twitterConsumerSecret": null,
                    "microsoftAccountClientId": null,
                    "microsoftAccountClientSecret": null,
                    "microsoftAccountOAuthScopes": null
                },
                "cors": null,
                "push": null,
                "apiDefinition": null,
                "autoSwapSlotName": null,
                "localMySqlEnabled": false,
                "ipSecurityRestrictions": null
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('site_name'))]"
            ]
        }
    ]

我有单独的模板来创建资源组和服务计划.部署后,一切都在 azure 上正确生成,但 Web 应用程序未连接到源代码管理.只有默认的 Web 应用程序.

I have separate template for creating resource group and service plan. After deployment everything is generated correctly on azure, but web app is not connected to source control. There is only default web application.

当我进入 Web 应用程序的部署选项时,有消息:未找到部署.Web 应用程序的资源组部署下有错误消息:参数 x-ms-client-principal-name 为 null 或为空.(代码:BadRequest).

When I go under deployment options of web app, there is message: No deployments found. There is error message under resource group deployments of web app: Parameter x-ms-client-principal-name is null or empty.(Code: BadRequest).

当我尝试通过 azure 门户进行相同的部署时,就可以了.当我创建 Web 应用程序时,之后我只需要连接到源代码管理,然后就会自动启动同步.

When I try doing the same deployment through azure portal then it is ok. When I create web app, after that I only have to connect is to source control, and sync is started automatically.

  1. 错误消息Parameter x-ms-client-principal-name is null or empty.(Code: BadRequest)"是什么意思,我该如何纠正?

  1. What does error message 'Parameter x-ms-client-principal-name is null or empty.(Code: BadRequest)' means and how can I correct it?

是否可以通过 Visual Studio 部署 Web 应用程序并将其连接到 vsts git 课程控制?

Is deploying web app through visual studio and connecting it to vsts git cource control even possible?

推荐答案

摘自我自己的问题:我回答的问题.

您是从 Visual Studio 运行的,对吗?VSTS git 是私有的 -如果问题与我的相同,则向 URL 添加凭据即可.不要使用您的真实凭据.

You are running from Visual Studio right? VSTS git is private - if the problem was the same as mine, adding credentials to the URL will work. Do not use your real credentials.

在与克隆按钮相同的 VSTS 区域中创建别名凭据并使用这些凭据.您的网址应如下所示:

Create Alias credentials in the same VSTS area as the clone button and use these. Your url should look like this:

https://newAliasUserName:NewAliasPassword@####.visualstudio.com/####/####

祝你好运.

这篇关于Azure - 使用 arm 模板从 Visual Studio 部署 Web 应用程序,连接到 VSTS git 源代码控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆