AZ-104: Prerequisites for Azure administrators

สำหรับอันนี้จะเน้น Recap AZ-900 การใช้ Tools ต่างๆ ได้แก่ Azure portal / Azure Cloud Shell / Azure PowerShell และ Azure CLI

Configure Azure resources with tools

Use Azure Resource Manager

  • resource / resource group / resource provider (มัน namespace {resource-provider}/{resource-type} ex. Microsoft.KeyVault/vaults.) / template + declarative syntax >> ARM Template Lock types
  • Read-Only locks, which prevent any changes to the resource.
  • Delete locks, which prevent deletion. Reorganize Azure resources >> Move RG / Move Subscription / Move Region 2 อันหลังมีข้อจำกัดแต่ละ Resource / ห้ามมี Dependency disk + VM และระหว่างย้าย RG Lock Remove resources and resource groups
  • Remove-AzResourceGroup -Name "ContosoRG01" resource limits ดูจากตรง Usage + Quota
  • Knowledge check - Training | Microsoft Learn

Configure resources with Azure Resource Manager templates

Automate Azure tasks using scripts with PowerShell

  • How to Choose an administrative tool >> Automation ? / Learning curve ? / Team skillset ?
  • ถ้าใช้ Azure Powershell Required 1.PowerShell 2.Azure Az PowerShell module
  • Sample Create Resource with PowerShell
Connect-AzAccount
Set-AzContext -Subscription '00000000-0000-0000-0000-000000000000'

Get-AzResourceGroup | Format-Table

New-AzResourceGroup -Name <name> -Location <location>
Get-AzResource
#Get-AzResource | Format-Table
#Get-AzResource -ResourceGroupName <<YOUR RESOURCE NAME>>

#Create VM
New-AzVm -ResourceGroupName <resource group name>
         -Name <machine name>
         -Credential <credentials object>
         -Location <location>
         -Image <image name>

#Getting information for a VM
$vm = Get-AzVM  -Name MyVM -ResourceGroupName ExerciseResources

#Update VM Setting
$ResourceGroupName = "<<YOUR RESOURCE NAME>>
$vm = Get-AzVM  -Name MyVM -ResourceGroupName $ResourceGroupName
$vm.HardwareProfile.vmSize = "Standard_DS3_v2"

Update-AzVM -ResourceGroupName $ResourceGroupName  -VM $vm

Get-AzPublicIpAddress -ResourceGroupName learn-4875047c-7ef2-49ce-9ccf-1570bee6ee79 -Name "testvm-01"

#Delete a VM
Stop-AzVM -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName
Remove-AzVM -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName

#Remove-AzVM command just deletes the VM. It doesn't clean up any of the other resources
#ถ้าพลาดไปแล้วลบตามลำดับ ดังนี้

$vm | Remove-AzNetworkInterface –Force
Get-AzDisk -ResourceGroupName $vm.ResourceGroupName -DiskName $vm.StorageProfile.OSDisk.Name | Remove-AzDisk -Force
Get-AzVirtualNetwork -ResourceGroupName $vm.ResourceGroupName | Remove-AzVirtualNetwork -Force
Get-AzNetworkSecurityGroup -ResourceGroupName $vm.ResourceGroupName | Remove-AzNetworkSecurityGroup -Force
Get-AzPublicIpAddress -ResourceGroupName $vm.ResourceGroupName | Remove-AzPublicIpAddress -Force

Control Azure services with the CLI

Deploy Azure infrastructure by using JSON ARM templates


Discover more from naiwaen@DebuggingSoft

Subscribe to get the latest posts sent to your email.