Is it possible to deploy separate azure roles to different services when publishing via Visual Studio? - visual-studio-2012

I have an azure project with two different web roles. I would like the different roles to be deployed to different services, not the same service. Is this possible, or do I need to create a separate azure project in visual studio?

You need to create a separate cloud service project. Although there might be a better way to accomplish your ultimate goal if you want to share more details about what you are trying to do. For example, you can host multiple sites within the same WebRole and use host headers to differentiate the traffic. This limits your scalability options (ie. you can't scale Website1 independently of Website2), but it can reduce costs if the load on the sites is low.

Related

Managing Azure Web Site Configutation

There are probably no less than 150 different configuration options for an instance/application of Azure App Service Web Apps. This is only part of the list and each of these items have various options and inputs.
Authentication/Authorization
Application insights
Managed service identity
Backups
Networking settings
Scaling settings
WebJobs
Push
MySQL in App
easy tables
data connections
API definitions
CORS settings
... etc, etc
From a configuration management perspective, how do I either source control these settings (preferred) in a config file or use a configuration management tool to manage them?
I don't see a way to define the individual apps in an ARM template.
My goal is to have a consistent and repeatable application configuration across multiple applications and prevent mistakes with manual setup.
Per my understanding, the settings you mentioned includes the whole configurations of the web app, like Deployment slots, Backups, etc.
AFAIK, you may not be able to control them(at least like Deployment slots, Backups,etc) via the ways you mentioned.
My goal is to have a consistent and repeatable application configuration across multiple applications and prevent mistakes with manual setup.
Currently, the closest way is to clone web app, you could use it via the portal or powershell, but it could not support clone the whole configurations in the web app even if you use it.
Also note: App cloning is currently only supported for premium tier app service plans.

Can I host WebRole and WorkerRole in same CloudService?

I have a blank Solution in .Net and add two Azure Cloud Services project in solution. One with WebRole and other with WorkerRole. Can I host the both project in one cloudservice instance or need separate for both.
Within a single cloud service, you may certainly have multiple roles, a combination of web and worker roles, each with their own specific projects within your Visual Studio solution.
When you deploy, you'll have yourapp.cloudapp.net with all of your roles (at least one instance of each).
Your question is a bit unclear about what you're looking for, regarding solutions and project. But... All roles which must coexist within a .cloudapp.net deployment must all be within a single Visual Studio solution. You cannot combine roles from multiple Cloud Service solutions.

How to share app settings between multiple Azure websites

I have an application which has multiple websites, one for each logical function:
User-facing
Back end - receives web hooks etc
Other
The sites have a bunch of configuration info. appsettings variables and connection strings in common. Regardless of how I do configuration management, eg via the Azure Portal or scripted via Powershell I want to do as little repeat as possible to keep things simple and reduce opportunity for errors when deploying/ managing these configuration settings.
What recommendations are there for managing this?
I would recommend deploying the various sites using ARM Templates. You can then use the same deployment parameters for multiple sites to end up with each having the same app settings.
As an aside, please note that deployment slots do not share app settings. You have to apply them to each slot. So it's probably not a good candidate for your needs.

In azure can multiple web apps perform CRUD operations on the same data

In azure I have a few web apps running using the same database.
But the data never clashes or anything; it's like azure has partitioned the database somehow.
I would like two web apps under different domains to access the same data with a separate api project.
What is the best way to configure this project in azure?
And in visual studio? Can I have them all in the same solution and publish them to the right place?
In Azure, you should setup one Azure SQL Database and multiple API Apps / Web Apps that all use the same connection string pointing to that database.
In Visual Studio, the best way to configure it depends on a couple of things.
If the WebAPIs are exactly the same just with a different domain
You can setup multiple publish profiles for a single Web Application Project. These publish profiles can tie to different release configurations which can transform things in your web.config to account for the differing domains. This is particularly important when using SSL, authentication or something like that.
If the WebAPIs are different for each domain
In this case, you will likely have different projects for each distinct WebAPI. You can have them all in one solution or separate solutions. It might be easier to setup different solutions if you want to enable automated build using Visual Studio Online or something as the Visual Studio build task keys off the *.sln file and if you have multiple Web Application projects in one solution your build outputs will be mixed up which can cause some issues when deploying.

Deploying and maintaining multiple copies of the same web application at different URLs on Azure

I'm currently investigating the possibility of my company using Azure.
Our current hosting situation that we run ourselves involves a separate site in IIS for each of our clients, each one having a virtual directory to the CMS we've built with ASP.Net web forms. We can update the contents of that virtual directory, which then provides the latest version of our CMS to all our clients at once.
I'm not looking to recreate that exact situation in Azure, but I am instead interested in figuring out how to create a single Web application in Visual Studio, publish that application to Azure in such a way that multiple sites (that I've specified) are created on Azure. Then I would like to be able to make changes to that application, and publish it again in a such a way that all the sites for it get updated all together, without requiring something be done manually per site/client.
The closest explanation I've found is this one:
http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/
That gets me close, but what I don't understand is that when I publish this application to Azure, I still only see one application / URL available in the Azure management console. Shouldn't the extra "Site" node result in a different site being available when I publish it? Why doesn't it? Is there a completely separate way to accomplish this that I'm not using?
When you look at the management console you're seeing the web roles that you have deployed, not the sites that are part of that web role which is why you're only seeing one. As long as you've followed the instructions correctly, then yes, you do have two sites running. The catch is that you can only access the main site through that default URL. Presuming you have urls that look like customer1.mysite.com and customer2.mysite.com, you need to make sure you've set these as the host headers in the sub sites and then change your DNS so both of these domains point to URL you can see in the portal (e.g. mysite.cloudapp.net).
When considering a multi-tenant solution, ideally you should design your web-application as a single website that is capable of responding to multiple tenants (each of your customers), as opposed to creating a website/web-application for each one of them. This makes updates across the system manageable.
Your web-application can partition and identity different tenants based on several options such as part of the url (e.g myapp/tenant1 vs myapp/tenant2) or via a host header (e.g. tenant1.myapp.cloudapp.net vs tenant2.myapp.cloudapp.net)
HTH

Resources