{"id":30395,"date":"2017-04-18T06:53:26","date_gmt":"2017-04-18T14:53:26","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=30395"},"modified":"2019-02-14T15:51:52","modified_gmt":"2019-02-14T23:51:52","slug":"deploy-php-application-to-azure-app-service-using-vsts","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/deploy-php-application-to-azure-app-service-using-vsts\/","title":{"rendered":"Deploy PHP application to Azure App Service using VSTS"},"content":{"rendered":"<p>This blog post shows how you can deploy a new PHP application from Visual Studio Team Services or Microsoft Team Foundation Server to Azure App Service.<\/p>\n<h2>Download the sample<\/h2>\n<ul>\n<li>Fork the Hello World sample app repository to your github account\n<pre class=\"\"><code class=\"lang-bash\">https:\/\/github.com\/RoopeshNair\/php-docs-hello-world<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2>Create a web app<\/h2>\n<ul>\n<li>From <a href=\"http:\/\/Azure portal\">Azure portal<\/a> &gt; App Services &gt; <strong>+ Add <\/strong>\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/AddAzureAppService-300x137.png\" alt=\"addazureappservice\" class=\"size-medium wp-image-30425 alignnone\" height=\"137\" width=\"300\" \/><\/li>\n<li>Select Web Apps &gt; Click &#8220;Create&#8221; with App Name, Subscription and Resource Group details. Once the deployment is successful, configure the PHP version in the &#8220;Application settings&#8221; to use &#8220;<strong>7.0<\/strong>&#8221; as shown below<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/CreateNewWebApp-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/CreateNewWebApp-1.png\" alt=\"createnewwebapp-1\" class=\"size-full wp-image-30455 aligncenter\" height=\"623\" width=\"914\" \/><\/a><\/p>\n<h2>Setup Release<\/h2>\n<ol>\n<li>Open the <span><\/span><strong>Releases<\/strong><span>\u00a0<\/span>tab of the<span>\u00a0<\/span><strong>Build &amp; Release<\/strong><span>\u00a0<\/span>hub, open the<span>\u00a0<\/span><strong>+<\/strong><span>\u00a0<\/span>drop-down in the list of release definitions, and choose<span>\u00a0<\/span><strong>Create release definition<\/strong><\/li>\n<li>In the DEPLOYMENT TEMPLATES dialog, select the <span><\/span><strong>&#8220;Deploy PHP App to Azure App Service&#8221;<\/strong><span> <\/span>template and choose<span>\u00a0<\/span><strong>OK<\/strong>.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/DeployPHPTemplate.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/DeployPHPTemplate.png\" alt=\"deployphptemplate\" class=\"size-full wp-image-30457 aligncenter\" height=\"669\" width=\"584\" \/><\/a><\/p>\n<ol start=\"3\">\n<li>Click &#8220;Choose Later&#8221; for the artifact to be deployed.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/ChooseLater.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/ChooseLater.png\" alt=\"chooselater\" class=\"size-full wp-image-30465 aligncenter\" height=\"275\" width=\"602\" \/><\/a><\/p>\n<ol start=\"4\">\n<li>Configure the <a href=\"https:\/\/www.visualstudio.com\/en-in\/docs\/build\/steps\/deploy\/azure-app-service-deploy\"><strong>Azure App Service Deployment <\/strong><\/a>task:<\/li>\n<\/ol>\n<ul>\n<ul>\n<ul>\n<li><strong>Azure Subscription:<\/strong><span>\u00a0<\/span>Select a connection from the list under<span>\u00a0<\/span><strong>Available Azure Service Connections<\/strong>. If no connections appear, choose<span>\u00a0<\/span><strong>Manage<\/strong>, select<span>\u00a0<\/span><strong>New Service Endpoint | Azure Resource Manager<\/strong>, and follow the prompts. Then return to your release definition, refresh the<span>\u00a0<\/span><strong>Azure Subscription<\/strong><span>\u00a0<\/span>list, and select the connection you just created.\n<strong>Note<\/strong>: If your Azure subscription is defined in an Azure Government Cloud, ensure your deployment process meets the relevant compliance requirements. For more details, see<span>\u00a0<\/span><a href=\"https:\/\/www.visualstudio.com\/en-in\/docs\/build\/concepts\/library\/government-cloud\">Azure Government Cloud deployments<\/a>.<\/li>\n<li><strong>App Service Name<\/strong>: the name of the App Service (the part of the URL<span>\u00a0<\/span><em>without<\/em><span>\u00a0<\/span>.azurewebsites.net)<\/li>\n<li><strong>Deploy to Slot<\/strong>: make sure this is cleared (the default)<\/li>\n<li><strong>Virtual Application :<\/strong><span>\u00a0<\/span>leave blank<\/li>\n<li><strong>Package or Folder:<\/strong><span> <\/span>Click on &#8220;&#8230;&#8221; button\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/PackageOrFolder.png\"><\/a><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/PackageOrFolder.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/PackageOrFolder.png\" alt=\"packageorfolder\" class=\"size-full wp-image-30475 aligncenter\" height=\"249\" width=\"715\" \/><\/a><\/li>\n<li>Click on &#8220;Link to an artifact source&#8221;<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/LinkArtifactsource.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/LinkArtifactsource.png\" alt=\"linkartifactsource\" class=\"wp-image-30495 size-full aligncenter\" height=\"515\" width=\"549\" \/><\/a><\/p>\n<ul>\n<ul>\n<ul>\n<li>Select the Github as the artifact source type and point it to your Github repository (forked earlier). You may need to create <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/build\/concepts\/library\/service-endpoints#sep-github\">GitHub endpoint<\/a><\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/GitHubArtifact.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/GitHubArtifact.png\" alt=\"githubartifact\" class=\"wp-image-30485 size-full aligncenter\" height=\"528\" width=\"550\" \/><\/a><\/p>\n<ul>\n<ul>\n<ul>\n<li>Select the repo root as the folder to deploy\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/SelectedPackage.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/SelectedPackage.png\" alt=\"selectedpackage\" class=\"wp-image-30497 size-full aligncenter\" height=\"290\" width=\"829\" \/><\/a><\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<ul>\n<ul>\n<ul>\n<li><strong>Advanced:(optional)<\/strong>\n<ul>\n<li><strong>Deployment script:<\/strong> The task gives you additional flexibility to run deployment script on the Azure App Service. For example, you can run a script to update dependencies (example composer extension) on the Azure App Service instead of packaging the dependencies in the build step.\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/04\/ComposerExtension.png\" alt=\"composerextension\" class=\"wp-image-30505 size-full aligncenter\" height=\"360\" width=\"782\" \/><\/li>\n<li><strong>Take App Offline:<\/strong><span>\u00a0<\/span>If you run into locked file problems when you test the release, try selecting this check box.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<ul>\n<ul><\/ul>\n<\/ul>\n<ol start=\"5\">\n<li>Type a name for the new release definition and, optionally, change the name of the environment from <span><\/span><strong>Default Environment<\/strong><span>\u00a0<\/span>to<span> <\/span><strong>QA<\/strong>. Also, set the deployment condition on the environment to \u201cAutomatically start after release creation\u201d.<\/li>\n<li>Save the new release definition. Create a new release and verify that the application has been deployed correctly.<\/li>\n<\/ol>\n<h2>Related Topics<\/h2>\n<ol>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/app-service-web\/web-sites-php-configure\">Configure PHP in Azure App Service Web Apps<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This blog post shows how you can deploy a new PHP application from Visual Studio Team Services or Microsoft Team Foundation Server to Azure App Service. Download the sample Fork the Hello World sample app repository to your github account https:\/\/github.com\/RoopeshNair\/php-docs-hello-world Create a web app From Azure portal &gt; App Services &gt; + Add Select [&hellip;]<\/p>\n","protected":false},"author":62,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-30395","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"acf":[],"blog_post_summary":"<p>This blog post shows how you can deploy a new PHP application from Visual Studio Team Services or Microsoft Team Foundation Server to Azure App Service. Download the sample Fork the Hello World sample app repository to your github account https:\/\/github.com\/RoopeshNair\/php-docs-hello-world Create a web app From Azure portal &gt; App Services &gt; + Add Select [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/30395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=30395"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/30395\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=30395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=30395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=30395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}