How Do You Troubleshoot Azure Template Files?

Problem scenario
You are having problems with your ARM templates (the .json files).  You want to learn more techniques at troubleshoot ARM templates. What should you do?

Possible Solution #1   Follow these directions on Microsoft’s website.
(You will need to download a .psm1 file and use the import-module command in PowerShell.)

Possible Solution #2
Clone this Git repo and use it to validate your ARM templates:  https://github.com/Azure/azure-arm-validator

Possible Solution #3
Substitute any very sensitive data from the JSON with dummy (fake or random) data. 

How Do You Troubleshoot the kubectl Error “Access denied status code: 403”

Problem scenario
You run a kubectl command but you get this error:

“could not get token: AccessDenied: Access denied
        status code: 403, request id:
Unable to connect to the server: getting credentials: exec: exit status 1″

What should you do?

Solution
The root cause is likely that your .kube directory has an incorrect configuration file. 

Possible Solution #1
If you are not using Amazon EKS,

How Do You Create the PowerShell Script, the Template.json and the Parameters.json Necessary to Utilize ARM?

Problem scenario
To use ARM templates you know know you should have three text files: 1) a PowerShell script 2) a template.json file and 3) a parameters.json file.

How do you create these for a given resource (e.g., a storage account, VM, or Function App)?

Solution
1.  In the Azure Portal web UI, start the process of creating a resource.  Right before you click “Create”,

How Do You Use an ARM Template to Create an Azure Serverless Function App?

Problem scenario
As a proof-of-concept you want to use an ARM template to create an Azure Function that uses Azure storage.  You want the template to create the Azure storage account as it is a dependency of the Azure Serverless Function (also known as an App Service).  How do you do this?

Overview
This will create an Azure Function also known as an App Service. 

How Do You Create a PowerShell Script to Create a Storage Account in Azure?

Problem scenario
You want to use an ARM template via a PowerShell script to create a storage account in Azure.  How do you do this?

Solution
Prerequisites

1.  If you are using Windows 7, you have installed Azure PowerShell; if you need assistance with this, see this posting.  If you are using Windows 10, you have installed the modules for Azure and the storage resource;

How Do You Install Azure PowerShell on Windows 10?

Problem scenario
You want to run ARM templates to declaratively create resources such as servers, databases, and subnets in Azure.  You need the PowerShell module for Azure to be installed for certain “reserved” words to work.  How do you install the Azure PowerShell?

Solution
1.  Open PowerShell as administrator.  (PowerShellGet is built into Windows 10 by default.  It may appear uninstalled, but it is natively part of the OS.)
2. 

How Do You Troubleshoot the “kops” error “unable to infer CloudProvider from Zones (is there a typo in –zones?)”?

Problem scenario
You run a “kops” command but you receive this error:

“unable to infer CloudProvider from Zones (is there a typo in –zones?)”

How do you get the “kops” command to work?

Solution
There is a value and a format that are necessary for your kops’ “–zones” flag.

Determine what region you want to know the zone name for (e.g.,

How Do You Troubleshoot the Amazon EKS Web Console Error “AccessDeniedException not authorized to perform: iam:PassRole on resource”?

Problem scenario
You are logged into the AWS web console.  You try to perform an operation but you get this error:

“AccessDeniedException
User: arn:aws:iam::12345678910:user/jdoe is not authorized to perform: iam:PassRole on resource: arn:aws:iam::12345678910:role/rolename”

What should you do?

Solution
1.  Create a role with “EKS” (to create Kubernetes clusters).  If you don’t know how, see this posting.
2. 

How Do You Troubleshoot the “kubectl” Error ‘the server doesn’t have a resource type “svc”‘?

Problem scenario
You are trying to use Kubernetes in AWS.  You have installed kubectl and you run this command:

kubectl get svc

You receive this:  ‘error: the server doesn’t have a resource type “svc”‘

You try again with a more verbose output.  You run this command:

kubectl get svc -v=8

In the output you see messages like this: “Response Status: 401 Unauthorized in 73 milliseconds”

What should you do to use kubectl with AWS?