Why do I like cli’s so much?

Well it’s because they talk to you, right. I mean ja it sounds crazy but let me try show you how I think about things, I am definitely not smart, I know a lot of seriously talented and gifted people out there.

I do think sometimes I just ask the right questions and with a growth mindset at least I enjoy the journey of discovery.

So lets get going.

Setup

Again the instructions are easy to follow, I’ll do baremetal as DevContainer is another post I want to dive deeper into.

curl -fsSL https://aka.ms/install-azd.sh | bash

It’s got a bunch of prerequisites that get installed automatically - things like the Azure CLI (az), Bicep CLI for Infrastructure as Code, and Docker if you’re planning to work with containerized applications. Pretty straight forward and no issues on my setup.

Talk to me please Mr Robot

Usage:
  azd [command]

Use "azd [command] --help" for more information about a command.

Please let us know how we are doing: https://aka.ms/azure-dev/hats

Now isn’t that just pretty 🤓, I like the feedback at the bottom, user experience always there for feedback.

For brevity I’ll cut down the output.

Cool, its got templates, great show me what templates you got.

 azd template

Cool says I can list them, so list them I shall.


 azd template list

So you’ll see all the normal stuff I guess except awesome terraform is there and Azure Container apps with AKS support coming later, that’s cool.

What’s interesting is the variety of templates available - from simple web apps to complex microservices architectures. Each template includes not just the application code, but also:

  • Infrastructure as Code (IaC) using Bicep templates in the infra/ directory
  • CI/CD pipeline definitions for both GitHub Actions and Azure DevOps
  • Environment configuration for development, staging, and production
  • Container orchestration setup where applicable

So I’ll go for the NodeJS App in CosmosDB with the MongoAPI, something I know so I always start with a smaller learning area.

azd template show Azure-Samples/todo-nodejs-mongo
Name                             Description
Azure-Samples/todo-nodejs-mongo  ToDo Application with a Node.js API and Azure Cosmos DB API for MongoDB on Azure App Service

So how do I use that, well I got to login first, so hop, skip and jump into that with az login and web browser auth.

azd login

Cool, now use the template, yes please.

azd up --template Azure-Samples/todo-nodejs-mongo

boop boop

Error: creating provisioning manager: required external tools are missing:
 - need at least version 0.8.9 or later of Bicep CLI installed. Run "az bicep upgrade"  to upgrade Bicep CLI version

Ah shucks I needed az bicep upgrade, thanks computer for letting me know, high five 🖐

This is a good example of how azd handles dependencies - it checks for the required versions of tools and lets you know exactly what you need to update. Bicep is Microsoft’s domain-specific language (DSL) for deploying Azure resources, and azd requires at least version 0.8.9 for compatibility with the latest template features.

az bicep upgrade

try that again.

azd up --template Azure-Samples/todo-nodejs-mongo

Will ask you for some details, whats the env name, azure location, sub to use etc.

What is interesting is I see typescript, playwright for tests and an infra dir, azdo and gh ready too, that’s nice.

Behind the scenes, azd up is doing several things:

  1. Provisioning infrastructure using the Bicep templates in the infra/ directory
  2. Building and deploying the application code to the provisioned resources
  3. Setting up monitoring and logging through Application Insights
  4. Configuring CI/CD pipelines if you’ve specified GitHub Actions or Azure DevOps

The TypeScript setup includes proper build configurations, and Playwright provides end-to-end testing capabilities right out of the box. Pretty comprehensive for a template!

Ooo and I like this, ja nerdy but I am in a shell so haven’t logged into az portals yet other than quick web auth which is closed now.

Provisioning Azure resources (9 of ~11 completed)... /

Finished.

View the resources created under the resource group rg-jeanthink-azd in Azure Portal:
https://portal.azure.com/#@/resource/subscriptions/blahblahblahblah/resourceGroups/rg-jeanthink-azd/overview

Show me the web, ooo nice, create some records.

Now the API please, super nice! OpenAPI Specification with Swagger tooling, very smooth…

Now fetch me the records I created please computer.

Now command line me.

  azd curl -X 'GET' \
  'https://BLAHBLAHBLAHBLAHBLAH.net/lists/633553d068f298072148a3db/items?top=5' \
  -H 'accept: application/json'
[
  {
    "listId": "633553d068f298072148a3db",
    "name": "Hello CLI my old friend 🥹",
    "state": "inprogress",
    "createdDate": "2022-09-29T08:14:35.556Z",
    "updatedDate": "2022-09-29T08:15:14.207Z",
    "dueDate": "2022-09-28T11:00:00.000Z",
    "id": "633553eb68f298072148a3e3"
  },
  {
    "listId": "633553d068f298072148a3db",
    "name": "buy food",
    "state": "todo",
    "createdDate": "2022-09-29T08:14:38.275Z",
    "updatedDate": "2022-09-29T08:15:19.318Z",
    "dueDate": "2022-09-28T11:00:00.000Z",
    "id": "633553ee68f298072148a3e5"
  },
  {
    "listId": "633553d068f298072148a3db",
    "name": "take a nap",
    "state": "todo",
    "createdDate": "2022-09-29T08:14:42.673Z",
    "updatedDate": "2022-09-29T08:14:42.673Z",
    "id": "633553f268f298072148a3e7"
  },
  {
    "listId": "633553d068f298072148a3db",
    "name": "whats sherlock up to?",
    "state": "todo",
    "createdDate": "2022-09-29T08:14:54.389Z",
    "updatedDate": "2022-09-29T08:14:54.389Z",
    "id": "633553fe68f298072148a3e9"
  }
]
%

So what did it just build?

Well Azure visualizer can help me, plus I just love this, I get lost in text but a picture or a face I understand and remember easily.

Oh sherbert I haven’t even take a look at the code, pop me a vscode.

code .

ooo now that is very neat hey.

Conclusion 🐒

I had an issue with the regions I was deploying to but that was more of an issue with my subscription, so user issue.

Easy fix, azd down and azd up again to another region and all good.

The awesome effort that was put into this tooling, tooling that helps devs stay where they add the most value for business, tooling built by devs for devs.

It was easy to follow with some great practices in there to start with and I just ❤️ the effort put in here and it shows.

Where to next for me:

  • Making your existing project azd compatible.
  • Configure DevOps pipelines.
  • Check out the other templates.
  • Make your own templates.

Where to next for you:

  • There is a community call next week so if you interested give that a go. Link below.
  • Check the docs for more information.
  • Let the team know if you run into any issues using the tooling, the more feedback the better.

Conclusion Monkey Score: 5/5 🍌 bananas

Resources: