Deploying ASP.NET Core Applications from Bitbucket to Azure

Give the most tedioust jobs to your laziest employee and they will automate it.

My boss

That’s right. I am lazy. I hate repetitive tasks. And as a developer you probably feel the same way.

One of those repetitive tasks is deployment

There are numerous ways and frameworks to set up automated builds and deployments. Some of them can do just about anything almost up to the point where they will make you coffee while you wait for your builds.

Recently while working on a small ASP.NET Core website I found out that Microsoft Azure has a very simple deployment tool for building and deploying from your favourite code repository to an Azure web application. I was especially happy to find that it supports BitBucket even though it seems anything not-on-Github is not cool.

Well, I am too old to be cool and I like Bitbucket so bear with me.


Setup is a breeze. Got to the new Azure portal and create your new web application.

After the web app has been created, go to your web app and choose “Deployment Options”.

The next steps allow you to log in to your source code provider (i.e. Bitbucket) and choose project and branch (typically the master branch). The beauty here is that Azure supports pulling code from all kinds of sources like Dropbox, Onedrive, Github, and of course Bitbucket.

After you save your settings, Azure will fetch your last commit and start building it. You can se the progress by clicking “Deployment options” again.

Build Errors?

It looks like Microsoft has just recently upgraded the compiler but I have previously run into problems with building newer C# features such as inline declaration of variables like so.

var salaries = new Dictionary()
    { "Jakob", 10000000000 },
    { "Some other guy", 42 },

// Inlining variable declaration
if (salaries.TryGetValue("Jakob", out var salary))
    // Do something with salary.

If you run into this problem, all you need to do is add the Nuget package Microsoft.Net.Compilers to your project. This will make sure that your project is compiled with the latest C# compiler.


This kind of deployment is extremely simple and easy, which is a good thing. On the other hand it will not run any unit tests in your project and it will deploy straight to production without any testing or staging. You might consider this solution for smaller, non-mission-critical sites.

稿源:Jakob’s View of the World (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合技术 » Deploying ASP.NET Core Applications from Bitbucket to Azure

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录