How to connect to VM hosted MySQL using Node.js in Azure Function

Recently, some customers asked for a demo about how to connect to VM hosted MySQL using Node.js in Azure Function, so this article provides a simple demo describes how to connect to VM hosted MySQL using Node.js in Azure Function. Prerequisites: A VM hosted MySQL server with remote connection allowed for user root : Procedures: 1.Create a JS Webhook connect, my function name is “testMysqlConn”: 2.Paste code below into the function(this function will connect to the VM hosted MySQL server and then execute sql in request body): module.exports = function (context, req) { context.log('JavaScript HTTP trigger function processed a request.'); var... Read more

The Refresh Token in Oauth2.0

The Refresh Token in Oauth2.0 1.Concept The biggest difference between Oauth2.0 and Oauth1.0 is the acquirement of access token, the access token of Oauth1.0 can be stored in the database and used for long time, the validity period is basically infinite, which result in its insecurity. The access token of And Oauth2.0 is valid for a short period, Therefore, Oauth2.0 brought in refresh token. In the oauth2.0, authorization code obtained the token and the default validity period is 1 hour (authorization code is disposable, once used and it will be invalid), so to use the refresh token, when we acquire... Read more

Using Azure Automation to Manage local resources | Part I : Get started on Hybrid Runbook Worker

Microsoft Azure Automation provides a way for users to automate the manual, long-running, error-prone, and frequently repeated tasks that are commonly performed in a cloud and enterprise environment. In this article, I will introduce how to install hybrid runbook worker, then we can manage our on-premise resources via azure automation later. Introduction The Hybrid Runbook Worker feature of Azure Automation allows you to run runbooks directly on the computer hosting the role and against resources in the environment to manage those local resources. Runbooks are stored and managed in Azure Automation and then delivered to one or more designated computers.... Read more

Using Azure Automation to Manage local resources | Part II : Schedule file copies from a local machine to an Azure Blob

In the Part I, we have learned how to manage local resources via azure automation hybrid runbook worker. In this article, I will show you how to schedule file copies from a local machine to an azure blob storage container. Steps Create a runbook using following code. <#PSScriptInfo .VERSION 1.0 .GUID 3a796b9a-623d-499d-86c8-c249f10a6986 .AUTHOR Azure Automation Team .COMPANYNAME Microsoft .COPYRIGHT .TAGS Azure Automation .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES #> <#  .SYNOPSIS  Exports the Run As certificate from an Azure Automation account to a hybrid worker in that account. .DESCRIPTION  This runbook exports the Run As certificate from an Azure... Read more

Develop with Azure Service Bus (3): Topic and Subscription

In this article, I will introduce you how to use “Azure Service Bus Client for Java” to work with topics and subscriptions in Service Bus. The architecture is showed as below: In contrast to queues, in which each message is processed by a single consumer, topics and subscriptions provide a one-to-many form of communication, in a publish/subscribe pattern. You can create multiple subscriptions for one topic. When sending messages to the topic, every subscription will be able to process the message. Next I will demonstrate the features with two pieces of code. To try it by yourself, you need the prerequisites below: The connection string of Service... Read more

Develop with Azure Service Bus (2): Queue

In this part, I will show you how to use Azure Service Bus through java sdk. It has undergone major changes that the Azure Service Bus Client for Java updated to 1.0.0 version , relative to the past  0.9.7 version. Here I provide 2 snippet code to show how to use the latest SDK to send/received messages in queue. Prerequisites The connection string of Service Bus. And its shared access policy should have “Send” and “Listen” permission enabled. Java Runtime Environment Java IDE (Optional) 1, Configuration Create a Maven project, and add the following dependency: <dependency> <groupId></groupId> <artifactId>azure-servicebus</artifactId> <version>1.0.0</version> </dependency> 2, Send message ... Read more

Develop with Azure Service Bus (1): Manage Service Bus

Microsoft Azure Service Bus is a reliable information delivery service. The purpose of this service is to make communication easier and implement the decoupling between modules. On the Azure service bus introduction, I will not repeat here, please refer to the official description: Azure service bus. To achieve the full operation of this article, you need to have the following prerequisites: An active Azure subscription Java Runtime Environment  Java IDE, Eclipse (Optional) This article will introduce how to use Azure portal / Java SDK to manage Azure Service Bus. 1. Create a Namespace To begin using Service Bus queues in Azure, you... Read more

Manage the Document DB via Powershell

Document DB is one kind of database service in azure (which has been integrated into the Cosmos DB), it is distributed, high scalable and high available. At present, many partners have said they have a demand for batch management of Azure services. While Azure offers a variety of options for managing Azure resources, each option has its advantages and disadvantages. Such as directly to manage Document DB via Azure Portal, although it is easy to use, but it is impossible to use to execute batch management tasks; Moreover, although the Rest API can achieve batch management, for the IT administrators, coding is still a more challenging... Read more

How to reset resource management VM administrator login credentials using ARM REST API

In Azure development,sometimes,maybe we need to reset login credentials.This article will guide you to reset login credentials using ARM(Azure Resource Managemrnt) REST API. For an Azure RM VM,you could reset its administrator login credentials via VM extensions.For windows VMs,the extension called “VMAccess Agent” is needed.And For Linux VMs, the extension called “VMAccess” is needed.However,don’t worry about that,installing a VM extension and then resting login credentials is very easy ,what you need to do is calling a REST API below: API request URL: PUT<subscription ID>/resourceGroups/<resource group name>/providers/Microsoft.Compute/virtualMachines/<vm name>/extensions/enablevmaccess?api-version=2016-03-30 Linux VMs request Body: {     "properties": {       "publisher": "Microsoft.OSTCExtensions",      ... Read more