Cloud types and service models in Azure
Learning objectives
In this module, you will:
- Compare each cloud computing deployment model (public, private, and hybrid).
- Understand the advantages of each cloud computing service model.
- Decide which deployment and service model you should use for your services.
There are three deployment models for cloud computing: public cloud, private cloud, and hybrid cloud. The following illustration shows an overview of these deployment models.
Cloud service models
Cloud computing resources are delivered using three different service models.
- Infrastructure-as-a-service (IaaS) provides instant computing infrastructure that you can provision and manage over the Internet.
- Platform as a service (PaaS) provides ready-made development and deployment environments that you can use to deliver your own cloud services.
- Software as a service (SaaS) delivers applications over the Internet as a web-based service.
Control Azure services with the CLI
In this module, you will:
- Install the Azure CLI on Linux, macOS, and/or Windows
- Connect to an Azure subscription using the Azure CLI
- Create Azure resources using the Azure CLI
Using the Azure CLI in scripts
If you want to use the Azure CLI commands in scripts, you need to be aware of any issues around the “shell” or environment used for running the script. For example, in a bash shell, the following syntax is used when setting variables:
1
2
variable="value"
variable=integer
Work with the Azure CLI
The Azure CLI lets you control nearly every aspect of every Azure resource. You can work with resource groups, storage, virtual machines, Azure Active Directory (Azure AD), containers, machine learning, and so on.
how do you find the particular commands you need? One way is to use az find, the AI robot that uses the Azure documentation to tell you more about commands, the CLI and more.
Example - find the most popular commands related to the word blob.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
az find blob
Finding examples...
Here are the most common ways to use [blob]:
Delete a blob.
az storage blob delete --container-name MyContainer --name MyBlob
Upload to a blob.
az storage blob upload --file /path/to/file --container-name MyContainer --name MyBlob
Get the details of a blob (autogenerated)
az storage blob show --account-name MyAccount --container-name MyContainer --name MyBlob
az find "az vm create"
Finding examples...
Here are the most common ways to use [az vm create]:
Create a default Ubuntu VM with automatic SSH authentication.
az vm create --name MyVm --resource-group MyResourceGroup --image UbuntuLTS
Create a default Windows Server VM with a private IP address.
az vm create --name MyVm --resource-group MyResourceGroup --public-ip-address "" --image Win2012R2Datacenter
Create a VM by attaching to a managed operating system disk.
az vm create --resource-group MyResourceGroup --name MyVm --attach-os-disk MyOsDisk --os-type linux
If you already know the name of the command you want, the –help argument for that command will get you more detailed information on the command.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
az storage blob --help
Group
az storage blob : Manage object storage for unstructured data (blobs).
Please specify one of the following authentication parameters for your commands: --auth-
mode, --account-key, --connection-string, --sas-token. You also can use corresponding
environment variables to store your authentication credentials, e.g. AZURE_STORAGE_KEY,
AZURE_STORAGE_CONNECTION_STRING and AZURE_STORAGE_SAS_TOKEN.
Subgroups:
copy : Manage blob copy operations. Use `az storage blob show` to check the status
of the blobs.
incremental-copy : Manage blob incremental copy operations.
lease : Manage storage blob leases.
metadata : Manage blob metadata.
service-properties : Manage storage blob service properties.
Commands:
delete : Mark a blob or snapshot for deletion.
delete-batch : Delete blobs from a blob container recursively.
download : Downloads a blob to a file path, with automatic chunking and progress
notifications.
download-batch : Download blobs from a blob container recursively.
exists : Check for the existence of a blob in a container.
generate-sas : Generate a shared access signature for the blob.
list : List blobs in a given container.
restore [Preview] : Restore blobs in the specified blob ranges.
set-tier : Set the block or page tiers on the blob.
show : Get the details of a blob.
snapshot : Creates a read-only snapshot of a blob.
sync [Preview] : Sync blobs recursively to a storage blob container.
undelete : The undelete Blob operation restores the contents and metadata of soft
deleted blob or snapshot.
update : Sets system properties on the blob.
upload : Upload a file to a storage blob.
upload-batch : Upload files from a local directory to a blob container.
url : Create the url to access a blob.
For more specific examples, use: az find "az storage blob"
How to create an Azure resource
When creating a new Azure resource, there are typically three steps: connect to your Azure subscription, create the resource, and verify that creation was successful. The following illustration shows a high-level overview of the process.
1
2
3
4
5
6
7
8
9
10
# Connect
az login
# Create
az group create --name <name> --location <location>
# Verify
az group list
az group list --output table
Create an Azure website using the CLI
Next, let’s use the Azure CLI to create a resource group, and then to deploy a web app into this resource group.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# create several variables that you will use in later commands
export RESOURCE_GROUP=learn-3e235359-ef6b-4932-a452-af72a7642a6c
export AZURE_REGION=centralus
export AZURE_APP_PLAN=popupappplan-$RANDOM
export AZURE_WEB_APP=popupwebapp-$RANDOM
# create a service plan
az appservice plan create --name $AZURE_APP_PLAN --resource-group $RESOURCE_GROUP --location $AZURE_REGION --sku FREE
# Verify
az appservice plan list --output table
# create a web app
az webapp create --name $AZURE_WEB_APP --resource-group $RESOURCE_GROUP --plan $AZURE_APP_PLAN
# Verify
curl $AZURE_WEB_APP.azurewebsites.net
# deploy code from GitHub
az webapp deployment source config --name $AZURE_WEB_APP --resource-group $RESOURCE_GROUP --repo-url "https://github.com/Azure-Samples/php-docs-hello-world" --branch master --manual-integration
# hit your site again with a browser or CURL
curl $AZURE_WEB_APP.azurewebsites.net
Summary
The Azure CLI is a good choice for anyone new to Azure command line and scripting. Its simple syntax and cross-platform compatibility help reduce the risk of errors when performing regular and repetitive tasks. In this module, you used the Azure CLI commands to create a resource group, and deploy a web app by using a small set of commands. These commands could be combined into a shell script as part of automation solution.