2017-09-04 43 views
1

我试图从使用arm模板的visual studio部署azure web应用程序(应用程序服务)。Azure - 从Visual Studio中使用arm模板部署web应用程序,连接到VSTS git源代码控制

这些资源从模板:

"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应用程序。

当我根据web应用的部署选项进行操作时,会出现以下消息:找不到部署。 Web应用程序的资源组部署中存在错误消息:参数x-ms-client-principal-name为null或空(代码:BadRequest)。

当我尝试通过天蓝色门户进行相同的部署时,则无问题。当我创建Web应用程序后,我只需连接到源代码控制,并自动启动同步。

  1. 是什么错误消息“参数X-MS-客户端主体名称为空或空(代码:错误请求)。”的意思,我该如何纠正呢?

  2. 是否正在通过Visual Studio部署Web应用程序并将其连接到vst甚至有可能的git cource控件?

+0

我刚刚问过一个非常类似的问题 - 我一直在这一天作战。 – Phish

+0

你有没有碰运气?我仍然无法找到解决方案! – gomila

+0

是的,只是让它工作,所以它是可能的。你是从Visual Studio运行的吗? VSTS git是私人的 - 您需要将您的凭据添加到回购网址。所以“https://用户名:[email protected]/_git/reponame”。 请勿使用真实的用户名和密码。在克隆按钮的VSTS中,您可以创建别名凭证。使用别名作为用户名和新密码作为密码。 – Phish

回答

0

从我自己的问题在这里采取:my answered question

您是从Visual Studio运行的权利? VSTS git是私有的 - 如果问题与我的一样,向URL添加凭据将起作用。不要使用您的真实凭据。

在与克隆按钮相同的VSTS区域中创建别名凭证并使用它们。您的网址应该是这样的:

https://newAliasUserName:[email protected]####.visualstudio.com/####/####

好运。

+0

非常感谢!解决方案是创建别名凭证。 – gomila

相关问题