In the previous post we saw how to connect to Azure Key Vault from Azure Functions. We used the Application Id and Secret to authenticate with the Azure AD Application. Since the general recommendation is to use certificate-based authentication, in this post, we will see how we can use certificates to authenticate from within an Azure Function.
First, we need to create an Azure AD application and set it up to use certificate-based authentication. Create a new service principal for the AD application and associate that with the Azure Key Vault. Authorize the AD application with the permissions required. In this case, I am providing all access to keys and secrets.
1 2 3 4 5 6 7 8 9 10 11 12
Create an Azure Function App under your subscription as shown below. You can also use the same application created in the previous post (if you did create one).
In the Function Apps page, select the app just created. Add a new function like in the last post. Selecting the Function App shows the available set of actions. Under the Platform Features tab we can upload the SSL certificates first and then update the Application Certificates to make the certificate available for the function.
Upload the certificate by selecting it from your folder system.
For the certificate to be available for use in the Azure Functions an entry should be present in Application Settings. Under Application Settings in the Platform Features tab add App settings key and value - WEBSITE_LOAD_CERTIFICATES and the certificate thumbprint This makes the certificate available for consumption within the function. Multiple thumbprints can be specified comma separated if required.
Using a certificate to authenticate with the Key Vault is the same as we have seen before.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
Make sure you add in the project.json as seen in the previous post to enable the required NuGet packages. The Azure function now uses the certificate to authenticate with Key Vault and retrieve the secret.
Hope this helps!
I try to stay offline for fixed times during the day and often prepare myself up for it. Having things to read is one of the important things to it. Feedly allows to keep track of all the reading sources that I have, while I am online. Some articles need more time and focus to be well understood, and I often end up ‘Saving them for Later.’
Pocket is an app that helps manage articles that you wish to read later. You can save articles, videos or pretty much anything into Pocket and view them later. The best thing about Pocket is that on mobile devices, it allows offline reading - i.e., without the need for an internet connection.
Pocket has apps and browser extensions for a variety of platforms making it easy to save articles that you find interesting. You can save to pocket while on your laptop or your mobile devices and have it available for later reading. Feedly integrates with Pocket and allows to save articles for future reading straight to Pocket. I am using the free version of Pocketand it works perfectly for me. But if you are interested in more advanced features you can upgrade to the Premium version.
Don’t miss out on that article that you want to read (later), Get Pocket!
The beginning of a good habit is the elimination of an excuse.
And The beginning of a bad habit is the finding of an excuse
The ability to pick on something and to make a habit of it is something that is always helpful. This skill helps to create new habits and also let go off old ones that are not doing any good to you. Part of letting of bad old habits might be creating new ones. When I wrote about Couch to Half Marathon, some of my readers asked how to keep up with the plan. How to do ‘Couch to Street’; just getting out there.
How Habits Work
To form new habits, it is important that we understand how habits work.
a simple neurological loop at the core of every habit, a loop that consists of three parts: A cue, a routine and a reward.
As Charles Duhigg points out in his book, Power Of Habits (recommended read) the formula for changing habits differs from habit and persons. So it is more about using a framework to understand how habits work and experimenting on changing it. Changing a habit does take time and is not an easy one, but with a process in place, it is doable with time and effort.
To break a bad habit one needs to identify it first. It could be anything from spending too much time on social media, eating unhealthy food, smoking, drinking, etc. Identifying that you have a habit and it’s not good for you to continue with it is important. You can only change something once you identify it.
Once you recognize the habit, find out what is the trigger for the habit. Is it a particular place, people, time, etc. It might be hard to find the specific cue that triggers the habit, so note down everything that you find applicable. Then work on to isolate the cue by monitoring the habit over a couple of days. Wire up the cue that triggers the habit to perform some other action. Create that plan in advance and have some way to remind yourself of it. If your cue is time-based or location based, then you can use your smartphone to pop-up a reminder. If not try to find ways to keep yourself reminded to perform the new plan. It feels hard in the beginning but stick to the plan, and in time you will be able to change your habit. I recommend you to read the book Power of Habits to understand this subject better.
Mini Habits and Short Term Goals
To start creating new habits, I have found setting smaller goals to target daily works better. I began writing at least one line every day to be consistent in blogging, running at least once a week to establish an exercise routine, eat at least one meal healthy, etc. Time-based cues help to enforce such new behavior. Setting aside a specific time as per the desired frequency to perform the activity makes sure that you do not skip doing it. Also, remember to keep the action as simple as possible so that you do not procrastinate when the time comes.
Like if it is running that you are planning to start it could be - Every Saturday at 6 am I will wear my running shoes and get out of my house. When the time comes, this is such a simple task that you have set for yourself, and you are more likely to do it. Once you have taken the pain of putting the shoes and getting out of the couch, you are more likely to run for at least five minutes.
Break your goals into small and achievable mini goals. These mini goals are often referred to as Most Important Tasks (MIT), Big Rocks etc. The key is to break them down into smaller achievable mini-goals and setting a cue to trigger the activity.
Motivation and Its Role
Very often we get motivated to start new activities and begin with great enthusiasm. In the beginning, we feel a spike in energy and see things happening. But soon you hit a point where you feel nothing is moving and you feel it a burden to continue. This stage is referred to as plateau - a state of little or no change following a period of activity or progress. You soon see your motivation levels dropping and justifying to yourself how little or no benefit your actions have. Eventually, you find yourself losing entire interest in the activity and start looking for new motivation spikes. This has happened to me many times.
Motivation is what gets you started.Habit is what keeps you going.
I have found this to be entirely true. We need the motivation to help us to get started with new activities and set new goals. But motivation alone cannot help us go all the way and achieve what we want. Before jump-starting with the idea give it a good thought to check if it is worth your time spent. If not park the idea to your Someday Maybe list (as referred to in GTD).
Once you have decided to pursue the idea, break it into smaller pieces and set achievable ‘mini goals.’ Set dedicated time at regular intervals for achieving these mini-goals. Most important is in having some ‘me time’ to get towards these goals. Like for me I have found that mornings work best for me and created a Morning Routine. To make sure that I make the best of my time I try to work in Pomodoro’s and inspect and adapt the process often.
Tracking and Feedback
Tracking is an important part of habit formation. Once you have set your goals and mini habits also find ways to track your progress. Inspect and Adapt is the fundamental principle behind Agile Processes. Habit formation is nothing but being agile, keeping the end goal in mind, adjusting the way you reach there. Find ways and tools to track progress on the habits that you are trying to form.
I prefer automatic tracking with least manual entry, so the tracking happens in the background. But at times you will have to resort to manual methods as well. Make sure you have a time set aside daily to capture the information. Having a review of the data obtained once every week or two and taking adjustment actions is equally important. Some of the tracking tools that I use are Rescue Time, Garmin Forerunner 630 and a few manual ones. I [review my progress every week] and try to incorporate feedback into the upcoming week.
All it takes to start a new habit is a moment - The moment where you decide on the new habit. The rest is process!
Eating Healthy, Exercise, Blogging, Waking up Early, Reducing time spent on Social Media, Reading and
Creating Videos (looking to give this up) are some of the habits that I have formed following these techniques. The ability to decide on something and getting it to done is the most important of all. Once you have mastered the skill of forming new habits, it boils down to choosing good habits and wiring that into your life. I have heard about the 21-Day rule of habit formation and similar myths. But I think all it takes to start a new habit is a moment - The moment where you decide on the new habit. The rest is process!
Do you want a one stop reading place to stay current and updated with posts from various blogs of your interest?
Feedly is a news aggregator application that compiles news feeds from a variety of online sources
Feedly is what you are looking for. You can subscribe to the sites and news sources that you want to follow and Feedly shows that as a combined list for you.
News sources can be grouped into custom collections to group similar categories of information. Feedly offers a clean and minimalist reading experience, removing all the ads and other elements that create clutter. You can save articles to be read later, mark as favorite, share articles and a lot more.
Feedly has apps and browser plugins for a broad range of platforms and provides a uniform experience across devices. Currently, I am on the free version of the application, and it has a limit of 100 feeds. The pro version provides a lot more features if you are interested.
Get a one stop reading place, Get Feedly!
First things first; Check if any of your accounts on the web has been compromised in the various data breaches. All you need is enter your email address in haveibeenpwned, and it tells you the rest.
My email did show up on multiple breaches, and there is nothing much that you can do about it anyways. The problem with data breaches is not confined just to the site that got breached but also with other sites if you have reused your passwords. The best that we can do is to use different passwords for each account that we create and never reuse them across sites. Also, remember to use ‘stronger’ passwords. So what makes a password stronger? - The one that you cannot remember.
A Password manager assists in generating, storing, and retrieving complex passwords from an encrypted database
Password Managers allows keeping all your passwords in a single strongly encrypted location. This manager itself is protected by a password - the master password!. The master password is the only password that you need to remember, so make sure you get this really strong!
There are different password managers out there, both paid and free. Personally, I use 1Password and love the experience that it has across all my devices. Initially, I was worried to have my passwords (password since I was mostly reusing the same one) on a cloud store with an external service. But with all these data breaches that I was part of and having realized that not having one is worse than having it in the cloud. Password managers don’t have to be perfect, they just have to be better than not having one. Having a password manager does not prevent your from being part of data breaches, but at least it protects your accounts elsewhere as you have not reused the password.
So if you still remember your passwords or reuse them, go set yourself up with a password manager!
Todoist Templates is a simple way to create tasks for any of your recurring activities. Be it blogging, cooking, or any of your activities. With Todoist Templates, you can turn any project into a checklist that you can easily duplicate later. I have been using Todoist for a long time and find it useful to keep track of tasks (both personal and at work)
I plan my tasks for the upcoming week on Sunday morning. I pull in tasks for the upcoming week, and some of these tasks are template based. For e.g. for writing a blog post, I have the below template
1 2 3 4 5 6
The dates on the template are relative to the day that you import the template in Todoist. So if I pull in the template on a Sunday, the tasks will start on Sunday. This is not something that I want; I want them to start on a Monday. Alternatively, I can update the template to start from tomorrow. Even in that case, I will always have to know the exact start day relative to the day that I intend to pull in. I usually plan for the tasks on a Sunday but still, like the flexibility to pull in tasks any day of the week.
Todoist Template Transformer
The Todoist Template Transformer takes in a date and template path and adjusts all tasks in the template to start relative to the passed in date. In the above example, if I want to blog on Wednesday, I will input the Wednesday date and the template file path. The first two tasks will start on Wednesday and the third and fourth on Thursday. Running the transformer on a Sunday (07-May-2017) with the next Wednesday (10-May-2017) below is the new template
1 2 3 4 5 6
This utility is written in FSharp the source code is available here if you are interested. I am still in the initial stages of learning FSharp, so if you have any suggestions to improve the code, please raise a Pull Request or drop in a comment.
It often happens when coding that I skip over some part and want to come back to it at a later point in time. I leave some comments in the code so that I do not miss it. It can be a bit tricky to keep track of these comments themselves. Before pushing up the changes to master branch or creating a Pull Request, I make sure that all such comments are addressed.
Visual Studio comes with a Task List that is handy to track such unfinished work in code. It helps track your pending work items in one place and easily navigate to it. To have a comment appear in the task list, it has to start with a defined token (TODO, HACK, UNDONE, etc.) followed by the comment.
1 2 3 4 5
A comment in your code preceded by a comment marker and a predefined token will appear in the Task List window. For example, the above comment has three distinct parts:
- The comment marker (//)
- The token (TODO)
- The comment (the rest of the text)
Visual Studio by default has TODO, HACK and UNDONE as tokens. You can modify this under Options -> Task List. New custom tokens can be added as required and used instead of the default ones.
When in a multi-member team you can either use custom tokens per member or append the comment with your name or feature name. The Task List provides Search feature with which you can filter the tasks created by you or for the feature you are working.
I try to remove all TODO comments before merging to the master branch. For tasks that need to be tracked even after a merge, I create separate work items to the project backlog (VSTS, GitHub Tasks, Jira whatever the team is using). I might still leave the TODO comment with the relevant ticket details as well for tracking.
The next time you leave some unfinished work for later make sure you have it tracked. Hope it helps!
Azure Functions is a solution for easily running small pieces of code, or “functions,” in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive, and you can use your development language of choice, such as C#, F#, Node.js, Python or PHP. Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop serverless applications on Microsoft Azure.
Even when developing with Azure Functions you want to keep your sensitive data protected. Like for example if the function needs to connect to a database you might want to get the connection string from Azure Key Vault. If you are new to Azure Key Vault check out these posts to get started. In this post, we will explore how we can consume objects in Azure Key Vault from an Azure Function.
Create Azure Function App: Let’s first create an Azure Function App from the Azure portal. Under New - Compute - Function App you can create a new Azure Function.
Enter the details of the new function app and press Create. Each function app has an associated storage account. You can choose an existing one or create a new one.
You can view all Azure Functions Apps in the subscription under More services - Function Apps
Create Function: To create a function you can create from an existing template or create a custom function. In this example, I will use a timer based function in C#.
In the run.csx file add in the code for the function. The below code fetches the secret value from the Key Vault and logs it. You need to provide the Azure AD Application Id and secret to authenticate with it. Make sure you add in the relevant using statements for the KeyVault client Azure Active Directory Authentication libraries (ADAL).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Since the KeyVaultClient and the ADAL libraries are NuGet packages, we need to specify these as dependencies for the Azure Function. To use NuGet packages, create a project.json file in the functions folder. Add in both the NuGet packages name and required version.
1 2 3 4 5 6 7 8 9 10
Executing the function, retrieves the secret details from the Key Vault and logs it as shown below.
Hope this helps you to get started with Key Vault in Azure Functions and keep your sensitive data secure.
IFTTT is a free web-based service that people use to create chains of simple conditional statements, called applets. An applet is triggered by changes that occur within other web services such as Gmail, Facebook, Instagram, or Pinterest. An applet may send an e-mail message if the user tweets using a hashtag or to copy a photo on Facebook to a user’s archive if someone tags a user in a photo
IFTTT helps you connect the services in your life. Most of the things that you use on the web is a service. There are a broad range of services that are available on IFTTT that you can start using right away. Each service has a set of triggers and actions. We can create applets which wire up triggers (if this) of one service to actions (then that) of another service.
There are a lot of pre-created applets available for immediate use. You can also create custom applets that wire up the triggers and actions of services of your choice. For e.g. Whenever a new item is available on my blog RSS feed I send an email to Buffer. The email to Buffer triggers it to share the post to all my connected social media accounts.
If you are consuming the services of IFTTT, then it is free to use. Paid plans are for publishing your service and making it available for others to consume. IFTTT also has apps for iOS and Android. With the apps you can also use the mobile capabilities like location, messages, etc. to trigger actions.
Start connecting the dots between your services and get the web to work for you.
If you spent a lot of time in front of a computer then f.lux is for you. You would have heard that using laptop or mobile just before sleep is bad. It is because of the blue light that digital screens emit.
During the day, computer screens look good—they’re designed to look like the sun. But, at 9PM, 10PM, or 3AM, you probably shouldn’t be looking at the sun.
f.lux fixes this: it makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.
Tell f.lux what kind of lighting you have, and where you live. Then forget about it. f.lux will do the rest, automatically.
f.lux adjusts the screen to the room you are in and the time of the day. You can set the lighting that the room has, and it will adjust the screen for it.