Implement IaaS in Azure Cheatsheets
Implement IaaS in Azure Cheatsheets
By Saeed Salehi
4 min read
- Authors
- Name
- Saeed Salehi
- linkedinSaeed Salehi
- twitter@1saeedsalehi
- Github
- github1saeedsalehi
- Website
- websiteBlog
Part of series
Developing Solutions for Microsoft Azure (AZ-204) certification exam Cheatsheets
- Part 1:
Introduction to (AZ-204) certification exam Cheatsheets
- Part 2:
Implement IaaS in Azure Cheatsheets
- Part 3:
Azure Functions Cheatsheets
- Part 4:
Azure App Service Cheatsheets
- Part 5:
Develop solutions that use Blob storage Cheatsheets
- Part 6:
Develop solutions that use Azure Cosmos DB Cheatsheets
- Part 7:
Implement Azure Security Cheatsheet
- Part 8:
Microsoft Identity platform Cheatsheet
- Part 9:
Monitoring And logging in Azure Cheatsheets
- Part 10:
Azure Cache for Redis Cheatsheets
- Part 11:
Develop message-based solutions Cheatsheets
- Part 12:
Develop event-based solutions Cheatsheets
- Part 13:
API Management in Azure Cheatsheets
Create and deploy virtual machine, deploy resources using Azure Resource Manager templates, and manage and deploy containers
Design considerations for virtual machine creation
Availability: Service Level Agreement of 99.9% (three-nines)
VM Size: processing power, memory, and storage capacity
VM limits: subscription has default quota limits. (Current: 20 VMs per region)
VM image:
az vm image list
VM disks
- standard disks: HDD , cost effective dev and test workload
- Premium disks: SSD , Production workload
disk storage:
- Managed disks: managed by Azure , Easy to scale-out , up to 4 terabytes
- Unmanaged disks: you’re responsible for the storage accounts, fixed-rate limit of 20,000 IO operation per second
Availability Zone
Physically separated within in a region, 3 availability zone per region
- Zonal Service: resource pinned to a specific zone
- Zone-Redundant: Azure automatically replicates across zones
Availability sets
Each availability set can be configured with up to 3 fault domains and 20 update domains.
logical grouping of VMs. protect against hardware failures and updates safely.
- Fault domains: group of underlying hardware that share a common power source and network switch
- Update Domain: ensures that at least one instance of your application always remains running
Virtual machine scale sets
load balanced VMs based on defined schedule or response to demand.
Azure Load Balancer
Layer-4 (TCP, UDP) load balancer , distributing incoming traffic among healthy VMs ( load balancer health probe monitors a given port on each VM )
Azure CLI
Login to azure
az login
create a resource group
az group create --name az204-vm-rg --location "<location>"
create a vm
az vm create \
--resource-group az204-vm-rg \
--name az204vm \
--image UbuntuLTS \
--generate-ssh-keys \
--admin-username azureuser \
--public-ip-sku Standard
open specific port
az vm open-port --port 80 \
--resource-group az204-vm-rg \
--name az204vm
clean up a resource group az group delete --name az204-vm-rg --no-wait
Azure Resource Manager
Azure Resource Manager is the deployment and management service for Azure. It provides a management layer that enables you to create, update, and delete resources in your Azure subscription.
Why ?
- Declarative syntax
- Repeatable results
- Orchestration
Template file
- Parameters - values which used in deployment
- Variables - Define values reused templates (can be combined with parameters value).
- User-defined functions - customized functions.
- Resources - specify resource to be deployed
- Outputs - Return values from the deployed resources.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"functions": [],
"variables": {},
"resources": [],
"outputs": {}
}
Resource Manager converts the template into REST API operations
Deploy template using:
- Azure portal
- Azure CLI
- PowerShell
- REST API
- Button in GitHub repository
- Azure Cloud Shell
conditional deployment
When the value is true, the resource is created. otherwise isn't created. can only be applied to whole resource.
Sample
Conditional deployment doesn't cascade to child resources
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string"
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"newOrExisting": {
"type": "string",
"defaultValue": "new",
"allowedValues": ["new", "existing"]
}
},
"functions": [],
"resources": [
{
"condition": "[equals(parameters('newOrExisting'), 'new')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[parameters('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "StorageV2",
"properties": {
"accessTier": "Hot"
}
}
]
}
deployment mode
- Complete mode: deletes resources that exist in the resource group that aren't specified in the template.
- Incremental mode: leaves unchanged resources that exist in the resource group but aren't specified in the template. (default mode is incremental)
Deploy Using Azure CLI
az deployment group create \
--mode Complete \
--name ExampleDeployment \
--resource-group ExampleResourceGroup \
--template-file storage.json
Azure Container Registry
managed, private Docker registry service based on the open-source Docker Registry
service tiers:
- Basic: Cost-optimized for lower usage scenarios
- Standard: Increased storage and image throughput
- Premium: Geo-replication,content trust
storage capabilities:
- Encryption-at-rest
- Regional storage
- Zone redundancy (premium)
- Scalable storage
ACR Tasks:
- Quick task:
docker build
anddocker push
in clouds - Automatically triggered tasks :
- source code update
az acr task create
- base image update
- schedule
- source code update
- Multi-step task:
yaml
based config file
Create an Azure Container Registry
create a ACR resource
az acr create --resource-group az204-acr-rg \
--name <myname> --sku Basic
build docker image using ACR
az acr build --image saeed:v1 --registry <myname> --file Dockerfile .
list repositories az acr repository list --name <myname> --output table
show tags on a specific repo
az acr repository show-tags --name <myname> \
--repository saeed:v1 --output table
run image in ACR
az acr run --registry <myname> \
--cmd '$Registry/saeed:v1' /dev/null
Azure Container Instances (ACI)
Offers the fastest and simplest way to run a container in Azure, billed by the second.
container group
Collection of containers that shares lifecycle, resources, local network, and storage volumes. Like POD in Kubernetes only supported in Linux containers.
Deployment
- ARM Template
- YAML file (pass
--file filename.yml
)
Networking
Containers within the group share an IP and port namespace.
Storage
Supported volumes to mount:
- Azure file share
- Secret
- Empty directory
- Cloned git repo
Create a container
az container create --resource-group rg-test \
--name mycontainer \
--image mcr.microsoft.com/azuredocs/aci-helloworld \
--ports 80 \
--dns-name-label $DNS_NAME_LABEL --location <myLocation> \
Verify the container is running
az container show --resource-group rg-test \
--name mycontainer \
--query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" \
--out table \
restart policies
- Always: default
- Never - one container must run within a group
- OnFailure: The containers are run at least once
pass paramater --restart-policy
when creating a container
Environment Variables
pass environment variable --environment-variables 'NumWords'='5' 'MinLength'='8'\
when creating a container
Azure file share in Azure Container Instances
fully managed file shares in the cloud that are accessible via the industry standard Server Message Block (SMB) protocol
Limitations:
- only available for Linux containers.
- requires the Linux container run as root.
- limited to CIFS support.
deploy container and mount a voulme
az container create \
--resource-group $ACI_PERS_RESOURCE_GROUP \
--name hellofiles \
--image mcr.microsoft.com/azuredocs/aci-hellofiles \
--dns-name-label aci-demo \
--ports 80 \
--azure-file-volume-account-name $ACI_PERS_STORAGE_ACCOUNT_NAME \
--azure-file-volume-account-key $STORAGE_KEY \
--azure-file-volume-share-name $ACI_PERS_SHARE_NAME \
--azure-file-volume-mount-path /aci/logs/
Upcoming events
The Test Automation Meetup
PLEASE RSVP SO THAT WE KNOW HOW MUCH FOOD WE WILL NEED Test automation is a cornerstone of effective software development. It's about creating robust, predictable test suites that enhance quality and reliability. By diving into automation, you're architecting systems that ensure consistency and catch issues early. This expertise not only improves the development process but also broadens your skillset, making you a more versatile team member. Whether you're a developer looking to enhance your testing skills or a QA professional aiming to dive deeper into automation, RSVP for an evening of learning, delicious food, and the fusion of coding and quality assurance! 🚀🚀 18:00 – 🚪 Doors open to the public 18:15 – 🍕 Let’s eat 19:00 – 📢 First round of Talks 19:45 – 🍹 Small break 20:00 – 📢 Second round of Talks 20:45 – 🍻 Drinks 21:00 – 🙋♀️ See you next time? First Round of Talks: The Power of Cross-browser Component Testing - Clarke Verdel, SR. Front-end Developer at iO How can you use Component Testing to ensure consistency cross-browser? Second Round of Talks: Omg who wrote this **** code!? - Erwin Heitzman, SR. Test Automation Engineer at Rabobank How can tests help you and your team? Beyond the Unit Test - Christian Würthner, SR. Android Developer at iO How can you do advanced automated testing for, for instance, biometrics? RSVP now to secure your spot, and let's explore the fascinating world of test automation together!
| Coven of Wisdom - Amsterdam
Go to page for The Test Automation MeetupCoven of Wisdom - Herentals - Winter `24 edition
Worstelen jij en je team met automated testing en performance? Kom naar onze meetup waar ervaren sprekers hun inzichten en ervaringen delen over het bouwen van robuuste en efficiënte applicaties. Schrijf je in voor een avond vol kennis, heerlijk eten en een mix van creativiteit en technologie! 🚀 18:00 – 🚪 Deuren open 18:15 – 🍕 Food & drinks 19:00 – 📢 Talk 1 20:00 – 🍹 Kleine pauze 20:15 – 📢 Talk 2 21:00 – 🙋♀️ Drinks 22:00 – 🍻 Tot de volgende keer? Tijdens deze meetup gaan we dieper in op automated testing en performance. Onze sprekers delen heel wat praktische inzichten en ervaringen. Ze vertellen je hoe je effectieve geautomatiseerde tests kunt schrijven en onderhouden, en hoe je de prestaties van je applicatie kunt optimaliseren. Houd onze updates in de gaten voor meer informatie over de sprekers en hun specifieke onderwerpen. Over iO Wij zijn iO: een groeiend team van experts die end-to-end-diensten aanbieden voor communicatie en digitale transformatie. We denken groot en werken lokaal. Aan strategie, creatie, content, marketing en technologie. In nauwe samenwerking met onze klanten om hun merken te versterken, hun digitale systemen te verbeteren en hun toekomstbestendige groei veilig te stellen. We helpen klanten niet alleen hun zakelijke doelen te bereiken. Samen verkennen en benutten we de eindeloze mogelijkheden die markten in constante verandering bieden. De springplank voor die visie is talent. Onze campus is onze broedplaats voor innovatie, die een omgeving creëert die talent de ruimte en stimulans geeft die het nodig heeft om te ontkiemen, te ontwikkelen en te floreren. Want werken aan de infinite opportunities van morgen, dat doen we vandaag.
| Coven of Wisdom Herentals
Go to page for Coven of Wisdom - Herentals - Winter `24 editionMastering Event-Driven Design
PLEASE RSVP SO THAT WE KNOW HOW MUCH FOOD WE WILL NEED Are you and your team struggling with event-driven microservices? Join us for a meetup with Mehmet Akif Tütüncü, a senior software engineer, who has given multiple great talks so far and Allard Buijze founder of CTO and founder of AxonIQ, who built the fundaments of the Axon Framework. RSVP for an evening of learning, delicious food, and the fusion of creativity and tech! 🚀 18:00 – 🚪 Doors open to the public 18:15 – 🍕 Let’s eat 19:00 – 📢 Getting Your Axe On Event Sourcing with Axon Framework 20:00 – 🍹 Small break 20:15 – 📢 Event-Driven Microservices - Beyond the Fairy Tale 21:00 – 🙋♀️ drinks 22:00 – 🍻 See you next time? Details: Getting Your Axe On - Event Sourcing with Axon Framework In this presentation, we will explore the basics of event-driven architecture using Axon Framework. We'll start by explaining key concepts such as Event Sourcing and Command Query Responsibility Segregation (CQRS), and how they can improve the scalability and maintainability of modern applications. You will learn what Axon Framework is, how it simplifies implementing these patterns, and see hands-on examples of setting up a project with Axon Framework and Spring Boot. Whether you are new to these concepts or looking to understand them more, this session will provide practical insights and tools to help you build resilient and efficient applications. Event-Driven Microservices - Beyond the Fairy Tale Our applications need to be faster, better, bigger, smarter, and more enjoyable to meet our demanding end-users needs. In recent years, the way we build, run, and operate our software has changed significantly. We use scalable platforms to deploy and manage our applications. Instead of big monolithic deployment applications, we now deploy small, functionally consistent components as microservices. Problem. Solved. Right? Unfortunately, for most of us, microservices, and especially their event-driven variants, do not deliver on the beautiful, fairy-tale-like promises that surround them.In this session, Allard will share a different take on microservices. We will see that not much has changed in how we build software, which is why so many “microservices projects” fail nowadays. What lessons can we learn from concepts like DDD, CQRS, and Event Sourcing to help manage the complexity of our systems? He will also show how message-driven communication allows us to focus on finding the boundaries of functionally cohesive components, which we can evolve into microservices should the need arise.
| Coven of Wisdom - Utrecht
Go to page for Mastering Event-Driven Design