AZ-900 Azure Fundamentals Resources

My curated list

There are plenty of resources out there to help you study for the AZ-900 exam. The exam is for candidates who are just beginning to work with cloud-based solutions and services.

It’s an opportunity to gather knowledge of cloud concepts, services, workloads, security, privacy, pricing and support. Here comes my list:

Cloud Concepts

Benefits
https://docs.microsoft.com/en-us/learn/modules/fundamental-azure-concepts/benefits-of-cloud-computing

Elastic
https://azure.microsoft.com/en-us/overview/what-is-elastic-computing/

Consumption and fixed cost models
https://docs.microsoft.com/en-us/azure/architecture/framework/cost/design-price

Shared responsibility
https://docs.microsoft.com/en-us/azure/security/fundamentals/shared-responsibility

Cloud Computing
https://docs.microsoft.com/en-us/learn/modules/fundamental-azure-concepts/types-of-cloud-computing

IAAS
https://azure.microsoft.com/en-us/overview/what-is-iaas/

PAAS
https://azure.microsoft.com/en-us/overview/what-is-paas/

SAAS
https://azure.microsoft.com/en-us/overview/what-is-saas/

Cloud Models
https://azure.microsoft.com/en-us/overview/what-are-private-public-hybrid-clouds/

Public cloud
https://azure.microsoft.com/en-gb/overview/what-is-a-public-cloud/

Geographies
https://azure.microsoft.com/en-us/global-infrastructure/geographies/#overview

Region and availability zones
https://docs.microsoft.com/en-us/learn/modules/azure-architecture-fundamentals/regions-availability-zones

Compute
https://azure.microsoft.com/en-us/product-categories/compute/

Virtual machines
https://docs.microsoft.com/en-us/learn/modules/azure-compute-fundamentals/azure-virtual-machines

Serverless
https://docs.microsoft.com/en-us/learn/modules/azure-compute-fundamentals/azure-functions

Previews
https://azure.microsoft.com/en-us/support/legal/preview-supplemental-terms/

Pricing
https://docs.microsoft.com/en-us/learn/modules/plan-manage-azure-costs/ https://azure.microsoft.com/en-us/pricing/calculator/
https://azure.microsoft.com/en-us/pricing/tco/calculator/


Core Solutions

Big Data
https://docs.microsoft.com/en-us/azure/architecture/guide/architecture-styles/big-data

IoT
https://docs.microsoft.com/en-us/azure/iot-fundamentals/iot-introduction

Cognitive Services
https://azure.microsoft.com/en-us/services/cognitive-services/


Goverance

Strategy
https://docs.microsoft.com/en-us/learn/modules/build-cloud-governance-strategy-azure/

Resource Groups
https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/overview#resource-groups

Azure Management Groups
https://docs.microsoft.com/en-us/azure/governance/management-groups/overview

Policy
https://docs.microsoft.com/en-us/azure/governance/policy/overview

Blueprints
https://docs.microsoft.com/en-us/learn/modules/build-cloud-governance-strategy-azure/8-govern-subscriptions-azure-blueprints


Identity & Access

Azure AD
https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-whatis

SSO
https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/what-is-single-sign-on

MFA
https://docs.microsoft.com/en-us/azure/active-directory/authentication/concept-mfa-howitworks


Management Tools

Azure Advisor
https://docs.microsoft.com/en-us/azure/advisor/

Azure Cloud Shell
https://docs.microsoft.com/en-us/azure/cloud-shell/overview

Azure Cost Management
https://docs.microsoft.com/en-us/learn/paths/az-900-describe-azure-cost-management-service-level-agreements/

Azure Key Vault
https://docs.microsoft.com/en-us/azure/key-vault/

Azure Monitor
https://docs.microsoft.com/en-us/azure/azure-monitor/overview

Azure Resource Manager
https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/overview

Azure Service Health
https://docs.microsoft.com/en-us/azure/service-health/overview

Azure Service Trust
https://servicetrust.microsoft.com/


Network & Security

Network
https://docs.microsoft.com/en-us/azure/security/fundamentals/network-overview

CDN 
https://docs.microsoft.com/en-us/azure/cdn/cdn-overview

Load Balancing 
https://docs.microsoft.com/en-us/azure/architecture/guide/technology-choices/load-balancing-overview

Defense in depth 
https://docs.microsoft.com/en-us/learn/modules/secure-network-connectivity-azure/2-what-is-defense-in-depth

Perimeter networks 
https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/perimeter-networks

VPN 
https://docs.microsoft.com/en-us/learn/modules/azure-networking-fundamentals/express-route-fundamentals

Network Security 
https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/considerations/networking-options

Network Security Groups 
https://docs.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview

DDoS 
https://docs.microsoft.com/en-us/azure/ddos-protection/ddos-protection-overview


I hope this list helps you.

How to test a Quarkus GraphQL API

With curl, the GraphQL tool, insomnia and Rest-assured

In the previous article I described the Quarkus GraphQL support and we discussed some GraphQL topics. Now I’ll show you how to test your GraphQL API with curl, the GraphQL tool, insomnia and Rest-assured. As an example I use my superhero project from my last article, which can be found on GitHub for you to run and play around with.

curl
If you would like to try the GraphQL API by yourself, start the Quarkus Project with mvn quarkus:dev and write the following:

    curl --request POST \
    --url http://localhost:8080/graphql \
    --header 'Content-Type: application/json' \
    --data '{"query":"{allCities{name}}"}'

That is quite simple. All we’ll need is to create a JSON payload, e.g. with a single element query with our query as its value. And as a result, you get this.

{"data":{"allCities":[{"name":"Gotham City"},{"name":"New York City"}]}}

GraphQL Tool
Let’s move on to the GraphQL tool. You can do the same query with the Quarkus GraphQL tool. Just enter http://localhost:8080/q/graphql-ui/. On the left side type in the query. Press the button with the triangle, and then you can see the result on the right side.

Insomnia
I think it’s pretty cool that you can test both REST and GraphQL APIs with Insomnia. To create a GraphQL query, you have to switch from Body to GraphQL on the far left. And that’s it.

Rest-assured
If you want to write automated tests, you could use Rest-Assured as we have already discovered. For the sake of completeness, I repeat the example from the last article. The response is plain JSON, so we can assert on the data returned by the API in the exact same manner with REST Assured as with REST APIs.

@QuarkusTest
public class SuperheroTest {
 
    @Test
    void allCities() {
        final Response response = given()
                .contentType(ContentType.JSON)
                .body("{\"query\":\"{\\n allCities{\\n name\\n}\\n}\"}")
                .when()
                .post("/graphql")
                .then()
                    .assertThat()
                    .statusCode(200)
                .and()
                    .extract()
                    .response();
 
        final List<City> allCities = response.jsonPath().getList("data.allCities", City.class);
        assertThat(allCities)
                .isNotEmpty()
                .hasSize(2)
                .extracting(City::getName)
                .contains("Gotham City", "New York City");
    }
 
}

Conclusion
As you have seen in this article, it is quite simple to test a GraphQL API. You can use curl for a quick check or the GraphQL Tool / Insomnia if you need more convenience. It’s even possible to use REST Assured to write automated tests because the response is pure JSON.

Photo by Nguyen Dang Hoang Nhu on Unsplash

Links
Github https://github.com/claudioaltamura/quarkus-graphql-superheroes
Quarkus SmallRye GraphQL https://quarkus.io/guides/smallrye-graphql
Insomnia https://insomnia.rest/
Rest-assured https://rest-assured.io/

GraphQL APIs with Quarkus

A query language for your API

In this article, I’ll show you Quarkus GraphQL support. As an example, I use the Superheroes application from my previous articles. We will discuss some GraphQL topics.

Code, dependencies and model
The source code for this app is available on Github. If you like, you can try the examples by yourself. As dependencies, I included e.g. SmallRye GraphQL and lombok. Here you can have a detailed look at the pom.xml file.

Quarkus helps you to create GraphQL APIs. The GraphQL schema is going to be generated. You just have to define your model. Here I show you as an example the Superhero data transfer object. I use DTOs to expose data from an API. Lombok @Data takes care of getter, setter, toString, and the equals and hashCode methods.

import lombok.Data;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public class Superhero {

    String name;
    City city;

}

Fetching data
To query all cities you just have to send a command like this to the GraphiQL UI http://localhost:8080/q/graphql-ui/:

{
    allCities {
        name
    }
}

And with GraphQL it’s quite easy to fetch object graphs. For example, we could query a city with their superheroes like this.

 query getCity {
     city(cityId: 0) {
         name
         symbol
         superheroes {
             name
         }
     }
 }

Resolver and mutations on the server-side
A resolver is responsible for defining queries. All Queries are located in SuperheroResolver.

@GraphQLApi
public class SuperheroResolver {

	@Inject
	SuperheroService superheroService;

	@Query("allCities")
 	@Description("Get all cities.")
 	public List<City> getAllCities() {
 		return superheroService.getAllCities();
 	}
 ...
}

I have separated the mutations from the queries. Mutations are write operations like create, update or delete. Here I show the create() method from SuperheroMutations with SuperheroInput as an input object.

@GraphQLApi
public class SuperheroMutation {

	@Inject
	SuperheroService superheroService;

	@Mutation
	public Superhero createSuperhero(@Name("superhero") SuperheroInput superheroInput) {
		var superhero = new Superhero(superheroInput.getName(), superheroInput.getCity());
		superheroService.addSuperhero(superhero);
		return superhero;
	}
...
}

Testing GraphQL APIs
It’s pretty cool that Quarkus automatically generates a GraphQL schema based on your source code. To display the schema, just invoke http://localhost:8080/graphql/schema.graphql. Here I want to show you quickly, how to write automated tests. How do we test a GraphQL API? Here comes Rest-Assured to the rescue. You can write tests in a manner as you already know from REST.

@QuarkusTest
public class SuperheroTest {

	@Test
	void allCities() {
		final Response response = given()
				.contentType(ContentType.JSON)
				.body("{\"query\":\"{\\n allCities{\\n name\\n}\\n}\"}")
				.when()
				.post("/graphql")
				.then()
					.assertThat()
					.statusCode(200)
				.and()
					.extract()
					.response();

		final List<City> allCities = response.jsonPath().getList("data.allCities", City.class);
		assertThat(allCities)
				.isNotEmpty()
				.hasSize(2)
				.extracting(City::getName)
				.contains("Gotham City", "New York City");
	}

}


Conclusion
I like the GraphQL support from Quarkus. It’s great that the GraphQL schema is generated automatically through code and annotations. In the next part I’ll show you how to test you GraphQL API with curl, the GraphiQL tool and insomnia.

Photo by Raphaël Biscaldi on Unsplash

Links
https://github.com/claudioaltamura/quarkus-graphql-superheroes
https://quarkus.io/guides/smallrye-graphql
https://rest-assured.io/

Document your database

Simply and easily with SchemaSpy

It has never been easier to document you db. SchemaSpy analyzes your database with tables, columns, types and indexes. It even creates diagrams with relationships of your existing database.

The installation is super easy. You just have to download SchemaSpy and your database driver. Even Graphviz is no longer required. The configuration is really simple. Here I show a config.

https://gist.github.com/claudioaltamura/c7e943622e4db159557b82b5135178a6

You run the tool with java -jar schemaspy-6.1.0.jar -configFile config.properties. Then you get a HTML documenation and the diagrams look like this.

And a really cool trick is to integrate SchemaSpy in your CI/CD pipeline. I really like this tool.

Links
http://schemaspy.org/

Writing key values from Java to Consul

How to write key values to Consul

In the first example we are going to use the HTTP API directly, in the second one we are going to use the Java Consul API ecwid. On Github you’ll find all the examples. So, let’s start.

HTTP API
In this example we store the value „buon giorno“ with the key „message“. And all you have to do is a REST PUT operation with v1/kv as a path. Here, Consul is reachable at http://127.0.0.1:8500. That’s it.

var value = "buon giorno";
var keyValuePath = "/config/consul-example/greetings/message";
var resourceUrl = "http://127.0.0.1:8500/v1/kv" + keyValuePath;

HttpRequest request = HttpRequest.newBuilder()
  .uri(new URI(resourceUrl))
  .PUT(HttpRequest.BodyPublishers.ofString(value))
  .build();

HttpClient
  .newBuilder()
  .build()
  .send(request, HttpResponse.BodyHandlers.ofString());

Java Consul API
The library is quite easy. First you have to create a ConsulClient with an URL. You use that ConsulClient for reading and writing. It’s just set* (with key and value) and get* methods. With the getKVValue() you get a Response<GetValue> instance. And for the real value you have to call getDecodedValue(). 🙂

ConsulClient consulClient = new ConsulClient("http://127.0.0.1:8500");

consulClient.setKVValue("/config/blueprint/greetings/note", "hello");

Response<GetValue> response = consulClient.getKVValue("/config/blueprint/greetings/note");

System.out.println("value: " + response.getValue().getDecodedValue());

Links
https://www.consul.io/api-docs#http-methods
https://github.com/Ecwid/consul-api

Validate JSON in Java with JSON Schema

Describe and validate your JSON documents

I programmed a lot with XML and XML Schema helped me to define which elements and attributes can appear in a document. So I always wanted a grammar for JSON too.

JSON Schema is exactly what I wanted. It has the following advantages:
* describes existing data formats
* provides human- and machine-readable documentation
* validates data

I tried two json-schema validator implementations for java: Everit and Networknt. I like the validator schema from Everit because of the similarity to the Bean Validation API. But if you use Jackson than Networknt is a good choice. Now I show an example with Networknt.

This is simple product schema product.schema.json .

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Product",
  "description": "A product from the catalog",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique identifier for a product",
      "type": "integer"
    },
    "name": {
      "description": "Name of the product",
      "type": "string"
    },
    "price": {
      "type": "number",
      "minimum": 0
    }
  },
  "required": ["id", "name", "price"]
}

And if you want to validate a JSON document called product.json than do the following:

JsonSchemaFactory factory =
  JsonSchemaFactory.getInstance(VersionFlag.V7);
InputStream is =  
  getClass()
  .getResourceAsStream("/product.schema.json");
schema = factory.getSchema(is);

JsonNode node =
  mapper.readTree(
    getClass()
    .getResourceAsStream("/product.json"));

Set<ValidationMessage errors = schema.validate(node);

Just read in the JSON Schema. Then map the JSON document to a JsonNode and call schema.validate(). That’s it.

I have shown you how to validate a JSON document which is very useful for automated testing and validating client submitted data. The whole implementation of this example and more can be found on Github.

Links
JSON-Schema
Everit-org json-schema-validator
Networknt json-schema-validator

@apiNote, @implSpec and @implNote with Gradle

How-to build JavaDoc

In this post, I explain to you how you can build JavaDoc with the new tags @apiNote, @implSpec and @implNote with Gradle.

Prior to the new tags, the „JavaDoc“ always consisted of documentation about implementation and informative notes in a mixed way. With @apiNote, @implSpec and @implNote you can place different kinds of documentation into separate documentation sections. This way you could enhance the clarity and readability of your documentation.

I give you a brief overview:
API Notes. This category consists of commentary, rationale, or examples pertaining
to the API.
Implementation Specification. This is where the default implementation (or an overrideable implementation in a class) is specified.
Implementation Notes. This section contains informative notes about the implementation, such as advice or performance characteristics.

For further information, please refer to the JEP draft.

So, if you want to build JavaDoc with theses tags, you just have to add additional JavaDocOptions to the task.

https://gist.github.com/claudioaltamura/aba1f6506a53b9f5499fd507abd572df

Links
build.gradle.kts Gist example

JEP draft: javadoc tags to distinguish API, implementation, specification, and notes

New Javadoc Tags @apiNote, @implSpec and @implNote

Microservices with Quarkus

Develop microservices with Quarkus and MicroProfile

I bet you already have heard about Quarkus and MicroProfile. Microservices is today the most popular architecture style when creating cloud-native applications. Spring Boot is a good choice, but typical frameworks like Java EE/Jakarta EE, are not sufficient.

Now Quarkus is an interesting alternative. Quarkus („Supersonic Subatomic Java“) is a MicroProfile implementation that focuses on efficiently running Java applications in containers and Kubernetes. MicroProfile gives you a good foundation for developing microservices-based applications by adopting a subset of the Java EE standards. The specifications include Config, Fault Tolerance, Health Check, Metrics, Open API, Rest Client, JWT Authentication and Open Tracing API.

So what are the advantages? A MicroProfile application with Quarkus using ahead-of-time (AOT) or even compiled to a native binary starts very fast and consumes less megabytes of memory. A simple Java JAX-RS application can start in 14 milliseconds while consuming only 13MB of memory.

I made a simple helloworld example by myself. Here I show you the HelloWorldController.

import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
@ApplicationScoped
public class HelloWorldController {

  @GET
  @Produces(MediaType.TEXT_PLAIN)
  public String hello() {
    return "hello world!";
  }
}

You find the full example on GitHub.

Links
Quarkus Getting Started https://quarkus.io/get-started/
Microprofile https://microprofile.io/
Quarkus Helloworld example https://github.com/claudioaltamura/quarkus-helloworld

HelloWorld with RESTEasy

An example with Gradle and current libraries

RESTEasy is a cool project for building RESTful Web Services with Java. It is an JAX-RS
implementation. And I really like the tight integration into quarkus.

I show you how to build a simple project with Gradle (build.gradle.kts):

plugins {
    war
    id("org.gretty") version "3.0.1"
}

repositories {
    jcenter()
}

dependencies {
    implementation("org.jboss.resteasy:resteasy-jackson2-provider:4.4.2.Final")
    implementation("org.jboss.resteasy:resteasy-client:4.4.2.Final")
    providedCompile("javax.servlet:javax.servlet-api:4.0.1")

    testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.1")
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.1")

    // Use JUnit Jupiter Engine for testing.
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.1")
}

val test by tasks.getting(Test::class) {
    // Use junit platform for unit tests
    useJUnitPlatform()
}

That’s everything you need for building the project.

And the REST Controller could look like this:

package de.claudioaltamura.resteasy.helloworld;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

@Path("/helloworld")
public class HelloWorldResource
{
   @GET
   @Produces("application/json")
   public HelloWorld greeting(@QueryParam("name") String name)
   {
      return new HelloWorld(name);
   }

}

If you now interested to learn more RESTEasy, than you can go deeper and look at the links below or at my github project.

Links
RESTEasy Documentation
https://resteasy.github.io/docs/

MicroProfile REST Client
https://github.com/eclipse/microprofile-rest-client

Jakarta RESTful Web Services (JAX-RS)
https://github.com/eclipse-ee4j/jaxrs-api

RESTEasy HelloWorld example
https://github.com/claudioaltamura/resteasy-helloworld

Consent Management Platform von Real Cookie Banner