Reading Notes #295

Sketch002

Cloud


Programming


Databases




Reading Notes #294

MagPi60-Cover

Suggestion of the week


Cloud


Programming


Miscellaneous



Reading Notes #293

IMG_20170813_103816-EFFECTSCloud


Programming




Reading Notes #292

cloudheight


Suggestion of the week


Cloud


Programming


Databases


Miscellaneous



Reading Notes #291

Blue-container

Cloud


Programming


Miscellaneous




Reading Notes #290

SEcurityCenterCloud


Programming


Databases


Miscellaneous



Reading Notes #289

IMG_20170710_092837

Cloud


Programming


Databases

  • Migrating to Azure SQL Database (Gavin Payne) - Very interesting and complete post that regroups references and gives details about some of the alternatives when it's migration time.


Reading Notes #288

IMG_20170706_063020

Cloud




Programming




Reading Notes #287

July1_800

Cloud


Programming


Miscellaneous


Reading Notes #286

Docker-Hub-NETCloud


Programming



Reading Notes #285

IMG_20170614_194330Cloud

Programming

Suggestion of the week

Miscellaneous



Reading Notes #284

IMG_20170609_092421Cloud

Programming

Miscellaneous




Reading Notes #283

June9Suggestion of the week


Cloud


Programming


Databases


Miscellaneous


Reading Notes #282

favicon[1]Cloud


Programming


Let’s talk Hybrid Cloud with Clemens Vasters at a Special Montreal Event.

CVastersThe summer is mostly here, and that usually mean a break for the community group, but the Azure Group of MSDevMtl still have one more surprise for you. Clements Vaster, the Microsoft's "Principal Messenger", driving global technical strategy for Microsoft's Azure Messaging platform services: Azure Service Bus, Azure Event Hubs, and Azure Relay, is coming to Montreal!

Join us on the Friday June 9th 2017, for a great talk about “Hybrid cloud”. These days most solution need to run by a combination of on-premises and public cloud assets. In this morning session, we will learn how those systems can be integrated. This perspective is, however, largely constrained to data-center like assets, and typically to the scope of one organization.

For this special event, we decided to remove the usual fee, so it's a FREE event!

Register quickly on the meetup site because the places are limited. Register here: https://www.meetup.com/msdevmtl/events/239731426/


See you there!


Reading Notes #281

AzureCLICloud


Programming


Databases


Miscellaneous



Reading Notes #280

IMG_20170511_082902Cloud


Miscellaneous


From a Docker container to MySQL as a Service in Azure in 5 minutes

Hello MySQL! It's been a while eh? You were at version 3 something, I was just getting stated with my professional career. We had fun for years... Then you know things changed, and I did something else. I was really happy when Microsoft announced, at the MSBuild,  the availability of MySQL as a Servive in Azure.
 
SearchMySQL

Creating a MySQL database with the portal is extremely simple. As usual, you enter the server name, database name and the Admin's password. At the time I'm writing this post, it was not possible to use any CLI, but I'm sure it will be available shortly. For the ones who are not used at Database as Service in Azure, one thing you will need to do to get access to your database from your computer is white listed your IP. It's very easy to do from the Azure Portal, just select the Connection Security tab on the left menu and add your address. Oh! And don't forger to click the save button. ;)

Firewall

During my tests, I've tried different applications (WordPress, Azure WebApp, custom on-premise app.) that use MySQL as backend database, I didn't notice any problem, and performance were great. It was just... simpler; no server to configure, no VM to configure, no update. The only "issue" I got was trying to connect Power BI Desktop to a MySQL, but I think it more related to the drivers since the service was still in early preview. I notified Microsoft, and I'm sure it will be available shortly.

Since it's been a while since I did some reel work with MySQL I didn't have any client install on my laptop. In fact, I had no idea which one I should take.

I knew we can run some CLI inside a Docker container with an interactive interface. So I decided to give it a try. A quick docker search mysql shows me that an image existed. Here are the steps to get setup.

First, let's download the image, and create an instance named mySQLTools of MySQL 8.0:

docker run --name mySQLTools --env "MYSQL_ROOT_PASSWORD=Passw0rd" -d mysql:8

Then using the -it let's bring the bash prompt to our terminal.

docker exec -it mySQLTools bash -l 

Finally we connect to our client using the usual settings (note that you must have no space between -p and your password):

mysql -h _ServerName.database.windows.net_  -u _UserName@ServerName_ -p_MyPassword_ _DatabaseName_

result

Voila! That's all what it takes to get started. And by the way, it will also work great with a Azure SQL Database.


docker pull shellmaster/sql-cli 

docker run -it --rm --name=sqlTools shellmaster/sql-cli mssql -s ServerName.database.windows.net  -u UserName@ServerName  -p YourPassword -d DatabaseName -e





Reading Notes #279

IMG_20170506_070903Cloud


Programming

  • Contributing to .NET for Dummies (Rion Williams) - Another post where the author shares his experience (I love those. That's the real life); this one about participating in an open-source project.

Databases


Miscellaneous



A static website and some little tricks with Azure Functions Proxies

(Updated 2018-02-08)

Recently, I did few presentations about Azure functions. The reaction was always very positive and attendees leave with tons of ideas of projects in their heads. In this post, I would like to add few interesting features that I didn't have the time to talk about.

You prefer to watch a video instead of reading? No problem, skip at the end at the Explain in a Video of this post immediately.

Let's get started


From the Azure Portal (portal.azure.com) select an Azure Function domain, or create a new one. Then we need to create a Function App that we will be use as our backend. Click on the "+" sign at the side of Function. In this post, we will be using the HttpTrigger-CSharp template, but other template will work too. Once you select the template you will be able to enter the name and select the Authorization level. This last choice will affect how your function could be accessed. For exemple, if you select Anonymous then you function will be accessible to everyone directly using the url: https://notesfunctions.azurewebsites.net/api/SecretFunction, where 'notesfunctions' is my function domain name. But if you select Function or Admin level, then you will need to pass a Function Key or Master Key (ex: https://notesfunctions.azurewebsites.net/api/SecretFunction?code=I4BN6NjaZBmPNqebqnX8pQAPZwe1TI/O4TCbvB1aaaaao7uRO5yyw==). For this post let's use the Function level. When ready click the Create button.

CreateFunction

Using Postman, your favorite HTTP tool, or even the function Test section (located on the right side of the editor in the Function blade), you can now test your Function. To be able to test our function, we need to know the URL. To get the URL of your functions, once you function is selected (when you see the code), click on </> Get function URL on the top of the screen.

TestSecretDirect

Note that the querystring as a parameter named code that is receiving our function key. When this parameter is not present, you will receive an HTTP 401 Unauthorized message. The function generated by the template also expects a value 'Name' that could be passed by the querystring or by a json file with a property Name in the http request body.

Azure Functions Proxies


Functions Proxies are currently in preview. With them, any function app can now define an endpoint that serves as a reverse proxy to another [API / webhook / function App / anything else].
Before being able to create new Azure Functions Proxies, you need to enable them. From the Function blade, select the Settings tab on the top of the screen, then click the On button, under the Proxie section.

EnableProxies

Now let's create our first Function Proxy. Click on the "+" on the right of Proxies (Preview). Enter the following values.

ProxySalutation

In the Backend URL note as %Host_Name% is used in the URL; this is NOT an environment variable. In fact surrounding a key with % is a very useful tool from the Azure Function that gives us the ability to read directly in the Application settings.

PlatformFeatures

To get to the Application settings, select the Function Application domain (the root node), then the tab Platform features from the top of the screen. In the image above, Point A shows on to access the Application settings, and Point B shows how to access the App Service Editor that will use later in this post.

If it's not already done, add a new key-value in Application setting: Host_Name with his value. Then from Postman, call this new proxy function. Note that now you don't need to pass the key since this part is done under the hood by the proxy.

TestSalutation

Do more with your Proxies


Okay, now that we have a proxy up and running, let's switch to the App Service Editor to do more "advanced" stuff (the Editor is available throuth the Platform features tab). Once you are in the editor select the file proxies.json to open it.

editor

As you can see we only have one proxy defined. Let's duplicate our proxy. Rename the copy "Override", and change the route value for override too. If you test this new proxy, it will work just as the other one. Let's change that a little, under the property backendUri add a new node called: responseOverrides. It is possible with proxies to edit the HTTP properties. To change the Content-Type to text instead of json add "response.headers.Content-Type": "text/plain" inside our new node responseOverrides (be aware, it's case sensitive). Test again Override and you will constate that the content indeed has changed.

Continuing that way you count use Azure Function Proxies as mock. For example, replace the backendUri property and override the response body to return a fix value, and voila! You built yourself a great mock-up! This is very useful! To illustrate this, add a new proxy using this code:
"Fake": {
    "matchCondition": {
        "route": "fake"
    },
    "responseOverrides": {
        "response.headers.Content-Type": "text/plain",
        "response.body": "Hello from Azure"
    }
}
If you call this last proxy, no backend will be called, but the HTTP call is working.

Static WebSite


Everybody knows that Azure storage is very inexpensive. Would it be wonderful if we could put a static website in that storage? Of course, you can do it, I mean as long as the URL was complete. However, who type the URL completely with the file and file extention (ex: http://www.frankysnotes.com/index.html)? Well now with Azure Function Proxy, we could fix that! Add another proxy to the proxies.json file using this code:
"StaticNotes": {
    "matchCondition": {
        "methods": [
            "GET"
        ],
        "route": "/"
    },
    "backendUri": "https://%blob_url%/dev/index.html"
}
This new proxy will "redirect" all root HTTP GET calls to our index.html file waiting in our Azure Blob storage. For a more professional look, you just need to add a custom domain name to your Function, and you got the perfect super-light low-cost website for your promotion campaign, or event.

static


Explain in a Video





References:

  • Postman : getpostman.com
  • App Service Editor: https://{function domain name}.scm.azurewebsites.net (ex: https://notesfunctions.scm.azurewebsites.net)



Reading Notes #278

azure_functions_featured_imageCloud


Programming


Miscellaneous

  • Designing a Conversation (Alexandre Brisebois) - Interesting post that digs into the paradox where "us", humans have been communicated since our beginnings but still have trouble doing it, now we want to plan ahead and architect communication with machines.
  • Introduction to Microsoft To-Do (Gunnar Peipman) - Interesting app Microsoft finally did his ToDo service.



Reading Notes #277

IMG_20170422_130532Cloud

Programming

Miscellaneous

  • Bots are the new Apps – Part 2 (Alexandre Brisebois) - This post asks a lot of questions. .Bots are could be very powerful but are they easy to build? Iterate, test, fail, learn, and try again.


Two Ways To Build a Recursive Logic App

Mostly everything is possible. It's always a question of how much time and energy we have. The other day I was building an Azure Logic App, and need it to make it recursive. First, I thought that couldn't be a problem because we can easily call a Logic APP from another one. This is right, nested Logic App is possible, but it's only possible to call another one. The "compilator" doesn't allow to do recursive call. I quickly found a workaround, but the day after I came to a cleaner solution.

In this post, I will share both ways to create a recursive call of a Logic App.

Commun Parts


Let's assume that our goal is to crawl a folder structure. It could be in any file connector: DroxBox, OneDrive, Google Drive, etc. For this post, I will use Sharepoint Online connector.

First, let's create our Logic App. Use the Http Request-Response template.

  1. Our Logic App will receive the folder path, that it needs to process, as a parameter. This is easily done by defining a JSON schema in the Request trigger.
    {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "properties": {
            "FolderName": {
            "type": "string"
            }
        },
        "type": "object"
    }
  2. To list all the content of the current folder. Add an action List folder from the SharePoint Online connector. The File identifier should be the trigger parameter: FolderName.

    Note: You need to edit the code behind for this action. I notice a strange behavior with space in the folder path.

    The current code should look like this:
    "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://mysharepoint.sharepoint.com/sites/FrankSiteTest'))}/folders/@{encodeURIComponent(triggerBody()?['FolderName'])}" 

    Change it by doubling the encodeURIComponent
    "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://mysharepoint.sharepoint.com/sites/FrankSiteTest'))}/folders/@{encodeURIComponent(encodeURIComponent(triggerBody()?['FolderName']))}" 
  3. For each element returned we need to check if it's a folder. One property of the returned object is IsFolder, we just need to use it in our condition:
    @equals(bool(item()?['IsFolder']), bool('True'))
    1. If it's a folder, we need to do some recursive call passing the path of the current folder to FolderName.
    2. Otherwise, when it's a file, do some process.

LogicApp_commun

Method 1: The quick and easy


Since we are forced to call a different Logic App, let's clone our Logic App. Close the editor and click the Clone button, name it FolderCrawler2.

cloneLogicApp

Now we need to edit both Logic apps by adding a call to the other one. FolderCrawler is calling FolderCrawler2 and FolderCrawler2 calls FolderCrawler.

FolderCrawler2

This method is really just a workaround, but it works perfectly. What I like about it is that it uses all the Intellisense at our disposal in the editor. Obviously, the big disadvantage is the code duplication.

Method 2: The Clean and light


The real way to do a recursive call is to use the URL from the Request in an HTTP POST call. Than in the body pass a JSON matching the schema containing the Path value.

httpcall

I hope you enjoy this little post. If you think of another way to do recursive call or if you have some questions, let me know!





Reading Notes #276

roslynSuggestion of the week


Cloud


Programming


Miscellaneous

Reading Notes #275

IMG_20170409_152323Cloud


Programming


Miscellaneous



~Frank



Reading Notes #274

2017-04-03_5-57-51Suggestion of the week


Cloud


Programming