I know you have all been waiting patiently for part two of this series. I’d like less time to go by in between these multi part blogs but sometimes life just gets in the way. In part one of this series, I showed you how to get started with Insomnia and how to get your ‘bearer token’. Now that we have these two boxes checked, we can begin to query the Azure Management API to get information about our Azure NetApp Files resources.

First, I’ll show you how to create a basic query to get a list of your NetApp Storage Accounts. For more information about the Azure NetApp Files storage heirarchy, head on over to docs.microsoft.com. Once we have a successful response to our basic query, we’ll create a more specific request and get some useful information about one of our Azure NetApp Files Volumes. Lastly, I’ll show you how to use cURL to query the API from the Linux command line. This can be really useful if you would like to integrate API calls into scripts or other automation tools.

Let’s get started.

Get a List of NetApp Accounts

Open Insomnia and if needed, switch to your ‘AzureNetAppFiles’ environment. It should look something like this: Insomnia Core

Continue reading

Hello and welcome to the first post in a three part series that will help you get up and running with the Azure REST API. More specifically I’ll show you how to use the Azure API to interact with your Azure NetApp Files resources.

Getting started with REST APIs can be a little tricky. There are several components to a REST API call. Combine that with the various types of authentication and things can get pretty overwhelming. Microsoft has chosen to use what is called ‘bearer token’ as the authentication method for their Azure Management API.

I’ll call this first part ‘bearer of good tokens’.

This ‘bearer token’ is unique to you and your Azure subscription. It needs to be passed as part of your REST API call in order to prove to Azure that you are authorized to interact with your Azure resources. This token should be treated as a very sensitive bit of information. Keep it in a secure place and don’t accidently commit it to a public code repository. (been there, done that!)

“This sounds exciting, how do I get my bear token!?”

Erm… that’s ‘bearer token’ and great question! Microsoft has made this quite easy and I have broken it down in to three easy steps:

  1. Create an Azure ‘service principal’
  2. Install and Configure Insomnia Core (REST API client)
  3. Issue a POST request to https://login.microsoftonline.com

Let’s dive in to each of these a little bit deeper…

1. Create an Azure ‘service principal’

I think the easiest way to do this is to use the Azure CLI (az cli):

az ad sp create-for-rbac --name "AzureNetAppFilesSP"

If you are not familiar with the Azure CLI, go check out this getting started guide.

The output (in JSON) should look something like this:

 "appId": "11111111-1111-1111-1111-111111111111",
 "displayName": "AzureNetAppFilesSP",
 "name": "http://AzureNetAppFilesSP",
 "password": "22222222-2222-2222-2222-222222222222",
 "tenant": "33333333-3333-3333-3333-333333333333"

We’ll need some of this information a bit later.

Continue reading

Author's picture

Sean Luce

Cloud Solutions Architect @NetApp

Cloud Solutions Architect @NetApp