How do I deploy an app with multiple components to Azure? - c#

So my application is composed of a handful of separate .NET components that all run in Azure. To give you an idea of what's involved:
A main ASP.NET MVC5/Web API 2 REST service that runs as an Azure website (I think they renamed these to web apps?).
A SQL database that the main REST service uses.
Another internal Web API REST service that the main REST service talks to that runs as an Azure website.
An Azure storage table that the the internal Web API REST service uses.
3 scheduled jobs (just .NET exe's) that do work in the background and also talk to the main SQL database.
All that's running great in Azure right now. My problem is automating the deployment and configuration.
Right now it's all manual. I right-click and publish both web apps from Visual Studio. I build and FTP up the web jobs. The database and Azure storage already exist so I don't have to re-set them up.
But say something bad happens - a datacenter goes down or something. I'd like to be able spin up a new version of my app (with all those components) that is ready to go with minimal effort.
I'm pretty new to the world of Azure so I'm not sure where to start. What are my options?

You are looking to automating deployments in Azure. I recommend to use ElasticBox to solve it.
To achieve the automation you will need to create a box for every different service or component you need to deploy (a box is the abstraction unit that uses to define the installation and configuration of the deployment of a service or application in any cloud).
It's possible also to create boxes based on VM Instances, VM Roles, or Worker Roles and also automate the deploy of Microsoft SQL Servers. Let's say near every option offered by Azure.
Then with those boxes completed (that can be customized and reuse your legacy code from your previous manual installation), you can deploy the multiple vms with near no manual intervention, just one click or a command with some parameters.
A box includes the variables necessary for your deployment (you can set default values for those variables) and your legacy scripts (In this case probably PowerShell, but they could be bash, python, perl, java, or any other language)
When you deploy your boxes:
Creates a Cloud Service or VM in the location that you choose and with the Azure configuration that you preconfigured. It takes care of provision the vm in your Azure provider, or near any other cloud provider in the market.
Installs, configure files with your specified variables and execute your SQL or Web services that you have defined.
Other ways to interact with the service:
Jenkins' Plugin could be used to build a CI environment connecting your code updated or a Pull Request with automated deployments in Azure or any other public cloud.
Command line tool that enables to do VM deployments of your boxes and also you can manage your deployed vm instances with it.

Azure Resource Manager (ARM) is intended to solve exactly the issues you described.
The basic idea is that you use a JSON template to describe all your services. You can then give that template to ARM and it will create the services as defined in the template. If you want to make a change, instead of doing it imperatively (via powershell or manually in the portal) just update your template, pass it to ARM and it will make whatever changes are necessary to make the services match your template.
Some resources:
ARM talk at MS Ignite 2015
ARM template language reference
Quickstart templates on GitHub
Azure Resource Explorer - view ARM templates of existing resources
Resource Group Deployment Projects in Visual Studio

I think your looking for something to help you handel deploys to your windows Azure servers. If that is the case I recommend looking into Jenkins CI. There are many resources available online you can look into in terms of having Jenkins and Azure work together.

Related

How can I make partialy deployed solution

Is it possible to create .NET MVC Core C# solution with multiple apps or modules and based on client selection of which app/module he wants to have I can deploy only selected apps/modules?
I need to deploy the only selected app/module and not include other apps/modules and the solution should work without breaking dependencies (such as classes).
I dont need to deploy each app in different C# application because that requires to install them on separate ports on IIS.
Similar scenarios I can refer to are: Zoho CRM or Odoo, user can select apps/modules that he likes to enable and start using them in his workspace

How to configure C# WinForms application to get EnvironmentName that it is deployed to on Azure?

This question is related to: .NET Core console application, how to configure appSettings per environment?
Question
How do I make a WinForms application environment-aware based on the different subscriptions that we have setup?
Context
I am finding very little documentation and examples on how to handle the deployment of Winforms applications to an Azure VM across multiple subscriptions. For example, if I deploy the Winforms application to a subscription that is marked as development, then it should use both the security groups and the SQL Server that is tied to the Development subscription. Rinse and repeat for UAT and Production.
Currently, we have a WinForms application that has multiple appsettings.<env>.json files for development, UAT, and production. We are using SlowCheetah to transform the appsettings.json file based on what the Configuration Manager says. This appears to be tied to the buildConfiguration parameter in the MsBuild pipeline task. We have different environment values in the appsettings files for the SQL Server connection string and security groups.
The application it intended to be deployed through a virtual machine and the environments are subscription-specific. How do we configure each subscription to contain the corresponding environment name and then pass that to the application on runtime? Would we still use SlowCheetah and set the environment through the buildConfiguration parameter in the MsBuild task, or would we do something else?
It seems like we can either go that route or we can use the Environment Variables route, but I don't see how the environment variable can be set for a virtual machine in Azure. Any help, documentation, or examples that I can pursue is greatly appreciated!
Note: for a web-application, this seems pretty straight-forward. Just setup the ASPNETCORE_ENVIRONMENT variable in both the project and in the Configuration within the App Service on Azure.
As clarified in the comments, and if I understand you correctly, you want to set environment options in Azure Portal and have them visible to programs running within the VM.
Note that Azure Virtual Machines are just Infrastructure as a Service - they're kinda bare with minimal Azure services provided on-top, consequently there's no notion of a VM being in Production or Staging - that's all up to you to implement yourself.
That said, you can set some configuration values in the Azure Portal (and through PowerShell) which are passed-on to the VM: this can be done using the "User Data" area of your VM's configuration area.
Note this only applies to ARM (Azure Resource Manager) VMs, not "Classic" VMs or "Cloud Service" AMs.

run databrick workspace from .net console app

I've got a databricks workspace that runs some python scripts to query some data. Is there a way to trigger this script in the workspace from the console app and have it output the data to azure blob storage? If so, can i pass parameters to the workspace from my app to use in the query?
Unfortunately, you cannot run Databricks workspace from the .net console app.
I would suggest you to provide feedback on the same:
https://databricks.com/feedback
All of the feedback you share in these forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure.
If you are interested in deploying your app to Databricks, make sure your app is .NET Standard compatible and that you use .NET Core compiler to compile your app.
This tutorial teaches you how to deploy your app to the cloud through Azure Databricks, an Apache Spark-based analytics platform with one-click setup, streamlined workflows, and interactive workspace that enables collaboration.
You can achieve this via REST API. This could be done via Jobs API, either by:
Creating the job for your existing notebooks or Python scripts, and then triggering the job via Run now command
Using Runs Submit call - in this case you won't need to create a job, but it looks like that you can't pass parameters to a job (that's quite strange, maybe the documentation is missing)
to use REST API you need to authenticate, but this is well described in the documentation

Automatic azure deployment

We've developed a MVC application that uses a SQL database to store data. We chose the approach to have a separate web app in azure (customer.ourdomain.com) per customer, as well as a separate database per customer running on our SQL server. This database is pointed to by the MVC application in the web.config file.
I've also created a website where new customers can register to use / try our product. Now every time somebody registers for our product I want the following to happen:
Create an Azure web app with the name of the company / customer that registers
Create a new database including the tables and relationships that our application needs
Publish the stable release of our application to the web app in azure and configure the application to use the newly created database
I've managed to do the first step using Azure ARM templates and the second step using dacpac and the Azure API, but I don't know how to use TFS (or any other method) to publish a stable release and change the connection strings before publishing the application to the azure app. (I've not even managed to publish anything with C# code).
Is the approach I'm taking in general okay or should I take a different approach? What is the best way to publish a stable release to the web app and most importantly, change the connection string so the published version will connect to the new database?
If you get vsts to package up your stable release and upload it to blob storage, you can reference that web app as part of the ARM template deployment, ie. include the web app code deployment along with the web app service itself.
This page shows how it can be done. I think you can also get the web app and ARM template to pull a release from vsts (I'm pretty confident you can do it via GitHub) using the app service's source control integration/CD settings as well, but cant find any details on this.

HTML5 with .NET backend App, compatible with both standalone Windows and Azure?

I need to design an HTML 5 responsive, and simple app that should work on both internal Win server and on Azure.Our Client wants to check out Azure but maybe later he will want this app to be on its own on premise servers. Our Developers are almost all .NET back ends, with basic knowledge in HTML 5, Javascript, Jquery, and bootstrap. We accepted the challenge because the project is tiny and interesting, the point is, is possible to have 1 project that can be deployed to azure or IIS with no problem? and what kind of project should we create? I think that a simple asp.net project with some web methods and js will do the job, but I don't know if it will work on azure too. Back n 2010 I did something that way but now I am not sure it's still valid
Important: the web application should be able to query oracle on premise server, via web service but not sure if take azure service bus or azure vpn
It depends on how you build your application. I have built applications in the past that works both on-premise and on Azure. As long as you don't access any Azure specific features, there's no problem to deploying the web application project to an on-premise IIS.
If you use Azure-specific features or services from Azure, such as Azure SQL DB, you have to built an on-premise version. In my case it was simple as changing the connection string and the rest was done by Entity Framework, but you can use an IoC container, such as Unity, to change your implementation based on the environment you're running on. If the Azure environment is available (check through RoleEnvironment.IsAvailable) you resolve the Azure-specific implementation of some features and if not the on-premise implementation. In most cases that are just a few dependencies, for example if you use a worker role on Azure and a Windows Service on-premise.

Categories

Resources