Book Image

Architecting Microsoft Azure Solutions - Exam Guide 70-535

By : Sjoukje Zaal
Book Image

Architecting Microsoft Azure Solutions - Exam Guide 70-535

By: Sjoukje Zaal

Overview of this book

Architecting Microsoft Azure Solutions: Exam Guide 70-535 will get Azure architects and developers up-to-date with the latest updates on Azure from an architecture and design perspective. The book includes all the topics that are still relevant from the previous 70-534 exam, and is updated with latest topics covered, including Artificial Intelligence, IoT, and architecture styles. This exam guide is divided into six parts, where the first part will give you a good understanding of how to design a compute infrastructure. It also dives into designing networking and data implementations. You will learn about designing solutions for Platform Service and operations. Next, you will be able to secure your resources and data, as well as design a mechanism for governance and policies. You will also understand the objective of designing solutions for Platform Services, by covering Artificial Intelligence, IoT, media services, and messaging solution concepts. Finally, you will cover the designing for operations objective. This objective covers application and platform monitoring, as well as designing alerting strategies and operations automation strategies. By the end of the book, you’ll have met all of the exam objectives, and will have all the information you need to ace the 70-535 exam. You will also have become an expert in designing solutions on Microsoft Azure.
Table of Contents (20 chapters)
Appendix A – Assessments
Appendix B – Mock Test Questions
Appendix C – Mock Test Answers

Creating highly available virtual machines

VMs can only be added to an an Availability Set by creation. When you want to add existing VMs to an Availability Set, this will result in recreating your VMs. This is something to be aware of when designing your solutions.

Creating highly available virtual machines from the Azure Portal

Follow the given steps to create a VM from the Azure Portal:

  1. Navigate to the Azure Portal by opening https://portal.azure.com/.
  1. Click on New and, on the right-hand side, choose an image (or you can type an image name in the search bar). For this demo, we have selected the Windows Server 2016 VM image:
Creating an Azure VM
  1. A new blade opens up where you can fill in the basic settings of the VM. Add the following details and click on OK:
Filling in the basic settings
  1. A new blade will open where you can choose the VM type and size. By default, only the recommended VMs are displayed, but you can choose to display all VMs by clicking on View all and then clicking on Select, as shown in the following screenshot:
Choosing your VM size
  1. A new blade opens up where you can configure additional options. Here, select Availability set and then click Create new:
Creating a high Availability Set
  1. By default, your VMs are assigned two fault domains and five update domains. Accept the default settings here and click on OK twice when prompted.
  2. The last blade opens up, which provides a summary with all the settings you've entered. Check the permission box.
  3. Click on Create and your VM is now created. Next to the Create button, you should see a link where you can download the ARM template of this virtual machine.
  4. Create the second VM and, instead of creating a new Availability Set, add the second VM to the Availability Set that we have already created using the previous steps.
You can download the ARM template of the configuration of the VM. This template can be used to deploy the second VM as well. There are a lot of templates available on GitHub that have been created by Microsoft and the community: https://azure.microsoft.com/en-us/resources/templates/.

Creating highly available virtual machines from PowerShell

VMs and Availability Sets can be created using PowerShell as well. Besides the traditional PowerShell, you can also use the Azure Cloud Shell to create your Availability Set. By using the Azure Cloud Shell, you are basically using PowerShell from inside the browser. Inside the Azure Cloud Shell, Windows users can opt for PowerShell and Linux users can opt for Bash. You can open the Azure Cloud Shell from the Azure Portal, as shown in the following screenshot:

Azure Cloud Shell

To create two VMs and add them to an Availability Set, add the following PowerShell statements to Azure Cloud Shell or Windows PowerShell (note that when using the Azure Cloud Shell, you don't have to log in):

Login-AzureRmAccount

If necessary, select the right subscription, shown as follows:

Select-AzureRmSubscription -SubscriptionId "********-****-****-****-***********"

Create a resource group:

New-AzureRmResourceGroup -Name PacktPubPS -Location WestEurope

Now, create an Availability Set:

New-AzureRmAvailabilitySet -Location WestEurope -Name AvailabilitySet02 -ResourceGroupName PacktPubPS -Sku Aligned -PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 2

Next, we need to create the two VMs and add them to the Availability Set. This is done by setting the -AvailabilitySetId parameter to the ID of the Availability Set. When running this script, you will be prompted for the username and password for your VM, as shown in the following snippet:

$availabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName PacktPubPS -Name AvailabilitySet02

$cred = Get-Credential -Message "Enter a username and password for the virtual machine."

$subnetConfig = New-AzureRmVirtualNetworkSubnetConfig -Name PacktSubnet -AddressPrefix 192.168.1.0/24
$vnet = New-AzureRmVirtualNetwork -ResourceGroupName PacktPubPS -Location WestEurope -Name PacktVnet -AddressPrefix 192.168.0.0/16 -Subnet $subnetConfig

$nsgRuleRDP = New-AzureRmNetworkSecurityRuleConfig -Name PacktNetworkSecurityGroupRuleRDP -Protocol Tcp -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 -Access Allow

$nsg = New-AzureRmNetworkSecurityGroup -Location WestEurope -Name PacktSecurityGroup -ResourceGroupName PacktPubPS -SecurityRules $nsgRuleRDP

# Apply the network security group to a subnet
Set-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name PacktSubnet -NetworkSecurityGroup $nsg -AddressPrefix 192.168.1.0/24

# Update the virtual network
Set-AzureRmVirtualNetwork -VirtualNetwork $vnet

for ($i=1; $i -le 2; $i++)
{
$pip = New-AzureRmPublicIpAddress -ResourceGroupName PacktPubPS -Location WestEurope -Name "$(Get-Random)" -AllocationMethod Static -IdleTimeoutInMinutes 4

$nic = New-AzureRmNetworkInterface -Name PacktNic$i -ResourceGroupName PacktPubPS -Location WestEurope -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id -NetworkSecurityGroupId $nsg.Id

# Specify the availability set
$vm = New-AzureRmVMConfig -VMName PacktVM$i -VMSize Standard_D2_v3 -AvailabilitySetId $availabilitySet.Id

$vm = Set-AzureRmVMOperatingSystem -ComputerName myVM$i -Credential $cred -VM $vm -Windows -EnableAutoUpdate -ProvisionVMAgent
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2016-Datacenter -Version latest

$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
New-AzureRmVM -ResourceGroupName PacktPubPS -Location WestEurope -VM $vm
}