Posts

Showing posts with the label Azure

Migrate Azure Scheduler jobs to Azure Functions

Migrate a code-based Azure Scheduler job to Azure Functions Recently, I migrated a scheduled job from .NET Framework 4.6 to .NET Core and from Azure App Service to Azure Functions. This was part of a larger effort to move to .NET Core, and the retirement of a dependency of Azure Scheduler jobs .  While there is nothing wrong with .NET Framework 4.6 or Azure App service, the project was moving toward separate, smaller, quicker deployments for the various projects instead of a single monolithic deployment. Existing scheduled job: Add feature flags Add the ability to control you job with a feature flag. In your Azure App service, create a feature flag for every scheduled job. This can be as simple as an App Configuration setting with a value or you can use Azure App Configuration.  Add code for the feature flag and make sure it has a default value if it isn't detected in the environment.  Add logging statements to report your runtime feature flag value.  Deploy the code...

Convert GoDaddy PEM certificate to PFX certificate to use in Azure App Service

 When you purchase GoDaddy certificates, you should get 3 files: *.crt file *.pem file *-key.txt file 1. Change the key file's name to the key extension so any future tools can find it by its extension. 2. If you download and/or open the key file on a Windows computer, your key file may now have the wrong encoding. Use a bash terminal and the  iconv CLI tool to convert to the correct encoding in a new file with a " 2 " added at the end of the filename to indicate the different file: iconv -c -f UTF-8 -t ASCII your-domain-name.key > your-domain-name. 2 .key 3. Convert to the PFX format with the openssl CLI tool: openssl pkcs12 -export -out your-domain-name.pfx -inkey your-domain-name. 2 .key -in your-domain-name.crt 4. You need to enter a new password when creating the PFX. Remember the password, you will need it when you add your certificate to Azure App Service.   5. In the Azure portal, for your App Service, select TLS/SSL settings.  6. Add a new TLS/SSL ...

Create Azure DevOps Pipeline for React App deployment to Azure app service

 Disclaimer: All opinions in this post are mine and not my employer (Microsoft). If you know of a more correct or performant way to accomplish work discussed in this post, please let me know at email javascript-developer@outlook.com . Many projects I work on are in progress by the time I work on them. I can't change previous design or architecture choices, but just solve a specific technical issue.  Secrets stored in Azure Key Vault All secrets for the React app are stored in Azure Key Vault. These secrets need to be pulled from Key Vault and set into the environment so that the `npm build` script uses those values. In order for the Azure DevOps Pipeline to connect to Azure Key Vault, you need to complete some work before you develop your Pipeline: Create a Key Vault and store your React build secrets, such as an Azure Functions key, used to authenticate and use the Function. Your secret doesn't have to have the same name as your React build variable. Please don't try. Ke...

Hosting front-end applications on Azure

Image
I have a catalog of small front-end Javascript apps built with Angular (ng) and React (CRA and Next) I would like to host on Azure. Hosting on Azure Azure provides features for a web host: * Options from big to small - full VM , container , web app , or host static website * HTTPS and URL - every Azure resource is served via HTTPS with a dedicated URL - no need to buy a certificate or domain name until needed. No Configuration changes In order to reduce hidden problems, each front-end app should be installed and running with no configuration change away from the development environment such as a to change the routing of assets from absolute to relative, or folder and subfolder naming. Consistent & immediate deployment Once the app is ready to deploy as a collection of static files, there shouldn't be a need to spend time preparing the hosting environment. The front-end system deployment steps should be consistent regardless of which front-end framework the proje...

Regex to search VSCode for Azure subscription keys

Image
Before you check in code, make sure the Azure subscription keys are removed or replaced with obvious markers. In VSCode, select the magnifying glass, the select the last icon on the line, "*." indicating the search is by regular expression. Enter [a-z0-9]{32} in the search text box and select enter. The search results appear below the search text box. Scan the results for any highlighted keys that are real key values.

Changing TLS setting for Azure web apps including Bot Framework

Image
If you need to change the TLS setting for you Azure web apps, including Bot Framework apps, go to the Azure portal. In the left navigation, select All Resources , sort the table by the type column. Any row with the type of app service may need the TLS setting updated based on on the service announcement here . On each service, select the SSL section , and change the Minimum TLS Version .

The Asp.net Core 2.0 Environment for NodeJs Developers

NodeJs & .Net Core NodeJs and the Asp.net ecosystems have used very different paradigms until recently. This article will show you where they are similar – the 10,000 feet view – when using the Asp.net Core 2.0 environment. With NodeJs, as the developer you might have chosen to build a web server or a cli tool.  Your favorite interactive development environment (IDE) might just be a terminal window or Google Chrome DevTools. With Asp.net (not .Net Core), Microsoft provided the web server ( IIS ) and the IDE ( Visual Studio ). You can develop many different applications including web sites and cli tools. With .Net Core 2.0 , the focus is on portable code, and the result feels much closer to NodeJs. For this article, I'm going to ignore all issues that would make the comparison apples to oranges and instead focus on issues that make the comparison apples to apples. Moving forward, any reference to Asp.net Core 2.0 will be just . Net Core . NodeJs 6.9.1 will be just No...

Azure VM LIcensing Error

When you log in to the Windows Azure VM, you may receive a popup that says you need to configure the licensing server. If you don't configure the licensing server, you only have X days left of access. You need to sign in to the Azure portal, download the RDP file for that virtual server, and only access the VM from that RDP.  The RDP file has access to the server, even after the licensing server grace period ends.

Migrating your Sql Azure Database Using Data-tier Application Technology

This blog post by Wayne Berry shows how to migrating your Windows Azure SQL Database Using Data-Tier Application Framework (DacFX) Technology to an on-premise SQL Server. With the Window Azure Portal, you can easily create a Data-Tier Application logical backup package (BACPAC), store it to your Windows Azure Blog Storage; and then, using SQL Server Management Studio 2012, you can import that package to your local database server. Read: Migrating your Windows Azure SQL Database Using Data-Tier Application Framework (DacFX) Technology {6230289B-5BEE-409e-932A-2F01FA407A92}

Combining Multiple Azure Worker Roles into an Azure Web Role

Image
Introduction While working on apps.berryintl.com ’s web service, it appeared from the Windows Azure project templates that I might need several worker roles because they cycle at different times. One worker needed to cycle every day. The other needed to cycle every five minutes. Since the work and the cycle rate were very different, it felt “right” to isolate each role. In this post, I’ll show you how I combined multiple worker roles into a single, underutilized Azure web role thereby keeping the concept and design of worker roles while not having to pay extra for them. In order to verify the solution, the project uses Azure Diagnostics Trace statements. The solution file is available for download . Combining Multiple Azure Worker Roles into an Azure Web Role Currently, I use a small Azure instance and there isn’t enough traffic to justify a separate worker role. I implemented Wayne ’s process for combining one worker role with a web role a while back. Now I needed to add anot...

Windows Azure Storage Table Names

Image
While writing a unit test for a class that created a Windows Azure Storage table, I named the test table “Test_Function_Date” where Function and Date where replaced with meaningful test information. The underscores in the table name were also there.   Azure CloudTableClient.CreateTableIfNotExist Exception While running the test, my call to CloudTableClient.CreateTableIfNotExist(TableName) threw an exception.     Illegal Table Name Exception Details The outer exception is Exception of type 'Microsoft.WindowsAzure.StorageClient.StorageClientException' was thrown. The inner exception is "An error occurred while processing this request." Buried in the inner exception XML is a status code of OutOfRangeInput, with a message of “ One of the request inputs is out of range .” Since this was a single unit test with not much prep work, I figured out it was the table name.   Azure Table Name Rules The rules for table naming allow: alphanume...

Unit Test Initialization and Cleanup for Windows Azure Storage Emulator

My unit tests add and delete entities from local Windows Azure dev storage,  at their most basic. If the Azure Storage emulator isn’t started, the tests don’t fail quickly – they just sit there acting like the test framework is hung. In order to ensure that the tests proceed, I needed to make sure the emulator was started before the tests ran.   I started with code found in this thread on StackOverflow . I needed to make sure the Storage Emulator is started before the test classes are called and that the emulator is shut down when the tests are done. I wrote this class and added it as a separate file to my test assembly.   More information about CSRun.exe and the Process class are available in MSDN .   // ----------------------------------------------------------------------- // <copyright file="AssemblySpecific.cs" company="BerryIntl"> // Berry International 2011 // </copyright> // ----------------------------------...

Simple Azure Web and Worker Roles–Running the code

Image
This is a continuation of the simple series. Links for other posts in the series are at the bottom of this post. Download Visual Studio Solution here .   This series explains the Windows Phone 7 requesting data from a Windows Azure web service. The phone tile and toast are supported by a background agent on the phone while the web service is supported by a continuous worker role on Windows Azure. The phone calls the WebRole REST API from both the phone app and the phone app’s background agent. Each request is different though. The App’s request is fetching a list of items to show in the app while the background agent is fetching the count of items since the last fetch and the very last item. This information will be displayed in the popup toast and the app’s start screen pinned tile.   Azure Only This post will cover the Azure web  and worker roles only. The Windows Phone 7 app-to-Azure communication will be covered in a separate post. Grab the Visual Studi...

Windows Azure Cache Tip: Use language change to refresh cache

Image
Several times using the Windows Azure Portal , the page has appeared to recycle correctly its 30 second refresh yet the process change I know reported success doesn’t show up. After a forum thread with a MS Support person, I learned to change the language setting at the top instead of log out and log in.   30 Second Refresh at the bottom left of the Browser Window     Change Language setting to refresh Portal Cache at the top right of the Browser Window

Windows Phone 7 and Windows Azure

Introduction This post will explain how Windows Phone 7 and Windows Azure relate to each other. This is in response to an email question I received over on my apps site. The person, apparently, had been assigned the task of “putting his rewards app on Azure.”   This post is a 100 level (introductory) explanation.   Client/Server Twenty years ago the client/server conversation was obvious with a physical client machine (perhaps a Windows version) connecting through a wire to a physical server. Usually these were in the same location or in some sort of private wide area network.  But they were just a client and a server.   Ten years ago the client/server conversation was a physical client machine connecting through a wire to a physical server that was not in the same building, probably not in the same state or country. But they were just a client and a server.   Since then, until Windows Phone and Azure, nothing really changed except the conne...