Skip to main content

Posts

Showing posts from 2020

No subscription found in the context.

FRUSTRATION!!! Don’t you just love it when you change nothing and then something breaks?   Working with VSCode and Azure, I do a lot of Infrastructure as Code.   I love the idea of being able to write code that builds exactly what I want, every time.   The problem is that on occasion, things change outside the scope of my code and now I am trying to solve a mystery.   The latest one involves whenever I run a simple Azure command.   For exam, Get-AZVM . This should not be hard.   Well, here is the result in VSCode. No subscription found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Connect-AzAccount to login So, I execute : Connect-AzAccount When you do this, it brings us to a website to go to and a code to enter. PS C : \ Connect-AzAccount WARNING : To sign in , use a web browser to open the page https : //microsoft.com/devicelogin and enter the code FNTC88YR4 to authenticate. Onc

Registering an Azure Resource Provider with PowerShell

Azure seems to be the cloud that just keeps building and building. Resource providers allow Azure to provide services.  For example, virtual machines utilize the Microsoft.Compute  resource provider to provide services to Azure so you can have a virtual machine.  Checkout this article to see what the Microsoft.Compute exposes to Azure:  https://docs.microsoft.com/en-us/azure/role-based-access-control/resource-provider-operations#microsoftcompute It is not that exciting to look at.  What is exciting is what resource providers can do.  Azure acts as an orchestrator.  The resource providers tell Azure what they can do and they perform all the work.  Each resource must be registered with the subscription before Azure can utilize them.  Just remember that you cannot unregister a resource provider if any Azure asset in your subscription is using it. (Note: The following assumes that you are using VSCode and are logged into your Azure subscription. Our goal is to register the Micros