Multiple web sites in one Azure Web App - azure

Is it possible to host 2 different sites in one Web App? I copied contents of both sites to D:\home\site\wwwroot\web1 and D:\home\site\wwwroot\web2 folders and bounded 2 subdomains web1.domain.com and web2.domain.com to my Azure Web App. I saw recommendation to edit ServiceDefinition.csdef, but I can't find it. I guess because it was not deployed with VS.
How can I achieve this goal?

Yes it is possible to host 2 different sites.
It can be done by creating virtual directory.
Publish the root project with help of VS.
On Azure portal from the web app create a virtual directory through app settings.
Now again publish the child project but edit the destination url like:
"http://123.azurewebsites.net/Child"

You're using Azure Webapp so there are no *.csdef files anymore. You can do this in the Azure Portal. Click on Application Settings blade and scroll down to "Virtual Applications and directories".
Here you can create additional apps. For example, here is one with 3 virtual apps. Note the path to the physical files.
Finally, when you deploy in your CI/CD pipeline, you'll have specific the name of your virtual app.

Related

How can I have access to the files in a Azure Static Web App?

In my Azure subscription an external company deployed from there BitBucket an application that I commissioned. The company ran out of business and I want to get all the files in the Static Web App to continue developing the application.
The Sku is Free. There is not Kudu to explore the content nor a FTP. I found same posts on Stackoverflow but all of them are dated.
Is there a way to access the Static Web App and/or copy the files?
Check the below steps to access the files of Azure Static Web App.
We can check the branch/source details in Azure Portal at 2 places.
Way 1 :
In Azure Portal => Your Static Web App => In Overview pane
We can find a Source and Deployment history options.
We can see the Source as Git.
Irrespective of the option we select to deploy the Application (GitHub/Devops/BitBucket), all the source files are saved in the GitHub Repository.
If we click on the URL, it will be redirected to the deployed files.
Way 2 :
In Static App => Under Settings tab, click on Environments.
We can see the Production Branch details. Click on the branch URL, it will be redirected to the Source files.
There is not Kudu to explore the content nor a FTP.
KUDU option is available only for Azure Windows App Service.
Refer drware Tutorial to Publish Azure Static Web Apps with Bitbucket.

Application Insights Live Metric for Virtual Directory Apps

I have an App Service on azure. It contains 2 web app set in 2 different virtual directory. There is no web app in the root folder. I have configure the Application Insight for both project in Visual Studio and publish each app to their azure virtual directory. But nothing is showing up in Live Metric of the Application Insight of the App Service. All I see is : "Not available: your app is offline or using an older SDK" .
It seems that Application insight could only run on root website.
BTW, the way you set up virtual applications may have some mistakes. You should set as below:
For more details, you could refer to the article-Deploying multiple virtual directories to a single Azure Website.
Also you will have to add the app insights SDK to all the app and be sure you set InstrumentationKey for each as well.
Refer this SO thread for similar kind of issue.

TFS 2018 Release Management to IIS

I am setting up a release for the first time in 2018 Release Management. We have a website that we want deployed to IIS.
The build definition is setup and has created the artifacts. When I setup the release definition I select the IIS Website Deployment template which gives me two tasks.
IIS Web App Manage
IIS Web App Deploy
They seem to cover similar ground, but I cannot find documentation to tell me how they are different. Do I need both?
When I configure IIS Web App Deploy, the Website Name field is grayed out. The link icon tells me
This setting is linked to the 'Website name' (Parameters.WebsiteName)
process parameter.
So I created the process parameter in the release definition and the build definition with a different name. However the Website Name does not update. Is there a way to manually edit this field?
In short:
IIS Web App Manage
This task does provisioning, for example creating an IIS Web Site and Application Pool. Typically this is only needed the first time deploying to a target machine, but there is no harm in running it on every deploy, since it then just skips creating already existing items.
IIS Web App Deploy
This task deploys your code.
You need to create a Deployment Group before using the IIS Website Deployment template. Deployment groups in VSTS/TFS make it easier to organize the servers that you want to use to host your app. A deployment group is a collection of machines with a VSTS/TFS agent on each of them. Each machine interacts with VSTS/TFS to coordinate deployment of your app.
Useful link and blog for your reference:
https://learn.microsoft.com/en-us/vsts/build-release/archive/apps/aspnet/aspnet-from-vsts-to-windows-vm?view=vsts
https://abelsquidhead.com/index.php/2017/11/28/build-and-deploy-to-multiple-iis-servers-and-sql-server-using-vsts/
If you don't want to use this template, you could also try other extensions, such as IIS Web App Deployment Using WinRM.
Both tasks are needed. The website name is set on the Environment level then referenced in all of the tasks within.

folder created within an api service not loading

I created an app service at http://testsam.controltrackonline.com, it loads properly. I have also created a folder within it called webapi but it does not load up and does not allow publishing content to it via appVeyor. The non loading folder location can be loaded here http://testsam.controltrackonline.com/webapi
I do not see any permissions issues surrounding this as other app services with same settings load well with folder within. But for this appservice there seems to an issue.
Any ideas?
It seems that you'd like to publish content to an Azure web app virtual directory, so please make sure you configure virtual directory or application under Application settings blade in the Azure Portal.
Note: you can also refer to "Deploying multiple virtual directories to a single Azure Website" to set up the virtual directory or application.
I have also created a folder within it called webapi but it does not load up and does not allow publishing content to it via appVeyor.
I do not see any permissions issues surrounding this as other app services with same settings load well with folder within. But for this appservice there seems to an issue.
Please try to use FTP or Kudu to access your Azure web site folder, and then you can try to upload your content package to webapi folder and check if it works as expected.
Besides, If issue only appear on that specific app service, you can create an Azure support request, Azure support can help you investigate the issue.

Does each Azure "App Service" instance run on its own VM?

(Note that I'm using the new "blade" Azure Portal exclusively and use the new terminology, so avoid words like "Azure Website" as they do not apply here).
In the Portal I created two Azure App Services, "foo-production" and "foo-staging" - both exist in the same Subscription and Resource Group, and share the same App Service Plan. These App Services represent the production and staging deployments of a straightforward ASP.NET web application, which runs as a normal website.
The App Service Plan is "Basic: 1 Small".
My understanding is that when you use Azure App Services with a Basic or higher App Service Plan, that the Plan represents a VM which I'm able to host as many IIS websites as I want on - these IIS websites are represented in Azure as Azure App Services.
Given this, one would assume when I access the filesystem of the VM in Kudu ( https://yourwebsite.scm.azurewebsites.net/DebugConsole ) that I would be able to see each website's files under some common root directory.
However when I access the Kudu console for the foo-production website, I see that its files are in D:\home\site\wwwroot and files for foo-staging are not to be found.
If I'm understanding this correctly, it means that Azure actually created a whole new VM just for each website and that websites cannot share a filesystem - and that I cannot have a more advanced Azure-managed IIS configuration - I'd have to create my own self-managed Windows Server VM.
I can understand the motivation behind a separate VM for each website, it just seems wasteful - Windows Server requires at least a gigabyte of memory for each VM, yet my website is largely just static files (but I can't use a Shared App Service Plan because I need some of the more advanced functionality). That can't be economical for Microsoft then.
How can I have multiple Azure App Services in an Azure-managed environment share the same VM? Or am I thinking about it incorrectly?
To avoid an X/Y problem: I'll state that my primary concern is the persistence of files. The web-application I'm deploying stores uploaded files to a subdirectory of the webroot and those files should be there permanently. There is ambiguous information out there: some people suggest websites (and all their files) are actively destroyed and recycled and that Azure Storage Blobs should be used. I would like to use Azure File Shares, unfortunately I get ACCESS_DENIED errors when using WNetAddConnection2 and some users report that Azure File Shares cannot be used from within Azure App Services - though I cannot find anything authoritative from Microsoft about this.
If they are in the same App Service Plan, they are running in the same VM. Try typing hostname in Kudu Console for each and you'll see the same machine name.
But note that they each run in a different sandbox, which prevents them from seeing each other's files. Folders like d:\home are virtualized, and are actually pointing to network shares. So you can't use that to make conclusions as to the machines are the same.
As I answered here, all app services within a plan run in the same set of VMs, sharing all compute resources.
You assumed each app service within a plan shares files with all other app services. This is incorrect: Each app service will have its own set of files, in d:\home for each app service. If you need to share files, you'll need to use something external to App Services, like Azure File Service (an SMB share). Azure File Service is separate from the space created for you on a per-app-service basis.
An Azure "App Service" is analogous to a "Container" (Docker terminology). Although it's based on a VM, it's much lighter weight than a VM itself. For example, you cannot RDP into it.
An Azure "VM" is a full-fledged virtual machine. The OS can be Windows or any of several different flavors of Linux.
You can get more information here:
Azure App Service, Cloud Services, Virtual Machines, and Service Fabric comparison
Here is an excellent article that compares Web Sites (one example of an App Service), Cloud Services, and VMs:
http://www.c-sharpcorner.com/UploadFile/42ddd2/azure-websites-vs-cloud-service-vs-virtual-machines/
Azure Websites
Azure Websites has very little responsibility to complete, and
relatively less control. It is the best choice for most web apps.
Deployment and management are integrated directly into the platform we
get.
Azure Cloud Services
If you want more, web server like environment you might want to go
with Azure Cloud Services. You can remote into your cloud services and
configure startup tasks. Cloud Services provide you more Ease of
Management and Agility than Azure Websites
Azure Virtual Machines
Provides you rich set of features; however, correctly configuring,
securing and maintaining VMs require much more time and more IT
expertise compared to Azure Cloud Services and Azure Websites.

Resources