- Deployment tools
- • Azure portal • Azure Cloud Shell • Azure PowerShell • Azure CLI • Azure SDKs • ARM templates
- You can create from
- User images
- Uses unmanaged disks
- Marketplace images
- User images
- Should be the first step
- Generalization resets server-specific data:
Computer name
- Security identifiers (SIDs)
- Local administrator/root identity
- Device driver cache
- Event logs
- How to generalize
- On Windows use
sysprep
, "System Preparation Tool" - On Linux run
sudo waagent -deprovision+user
- Take a VM backup first, because generalization is destructive and permanent
- On Windows use
- Managed Disk Concepts
- Disks
- No storage account (management) required
- Pay for pre-allocated storage (P10 =128 GB SSD VHD)
- Snapshots
- Read-only full copy of a managed disks
- You can create new VMs based on snapshots
- Images
- Generalized VM disk images
- Snapshots can be converted into images
- Disks
- Flow
- Get an image
- Get a snapshot image
- Go to Disks → Select OS disk → Create snapshot
- In snapshot → Click on Export → You will get SAS url → Download VHD
- Generalize the image
- Or capture an image
- In portal: VM → Overview → Capture
- ❗ Not generalized
- It appears in images
- Get a snapshot image
- Go to Images in portal, select the image, from there click on Deploy and it'll navigate you
- Get an image
- You have different levels of security NSG, host firewall, options to have public IP or not
- Allowed by Azure Defender (formerly known as Azure Security Center Standard tier)
- Locks down all administrator ports as default, when admin requests admin session then session is bounded by time limit and IP address restriction while granting access.
- No need to have management port open all the time
- 💡 Recommended to enable
- Around 40% of workloads in Azure runs on Linux
- Endorsed in Azure: CentOS, CoreOS, Debian, Oracle Linux, Red Hat Enterprise Linux, SUSE Enterprise Linux, openSUSE, Ubuntu
- Connection
- Secure Shell (SSH)
- A popular client is PuTTy for SSH or you can install subsystem for Linux or git tools on Windows 10 to get SSH.
- Remote Desktop Protocol (RDP)
- You can install RDP on Linux.
- Some do not believe in graphical shell:
- Presents security vulnerability possible
- Needlessly consumes CPU
- Windows team ported RDP into linux.
- Serial Console
- COM1 serial port connection to VM
- Low-level access
- Helpful when e.g. your VM doesn't boot up
- Secure Shell (SSH)
- Authentication
- SSH Public Key
- You keep private key and share public key with Azure.
- Password
- You can reset those after deployment in portal: VM → Reset password
- SSH Public Key
- Windows Server 2019, 2016, 2012, 2008, Windows 10 Pro or Enterprise (for e.g. load testing, client-side testing, jump-box)
- Connect
- Remote Desktop Protocol (RDP)
- Uses TCP 3389
- You can connect directly from Portal: Overview → Connect
- WinRM (PowerShell) Remoting
- TCP 5985, 5986
- Serial Console
- Text console into VM
- Can get to VMs that can't boot
- Remote Desktop Protocol (RDP)
- RBAC vs Azure Policy
- RBAC
- Focuses on user actions at different scopes
- VM Contributor can manage only VM
- Built-in custom roles
- Azure Policy
- Focuses on resource properties during deployment for already existing resources
- Uses default allow and explicit deny access system
- Difference
- You're not going to be able to create VM unless you have read & write abilities by RBAC
- Azure Policy in contrast constrains what that RBAC can do when she/he attempts to create VM
- RBAC
- Some built-in Azure Policy definitions are e.g.
allowed locations
,VM SKU
,ensure MMS extension is deployed
- You can create also own policies, or initiatives which are collections of policies.
- Examples
- Policy definition e.g. allowed locations
- Parameters e.g. select which regions are allowed
- ARM templates are infrastructure as code foundation of automation and DevOps in Azure
- 💡 Visual Studio is a good ARM template editor
- Visual Studio Code can also be used.
- Different ways to work with templates
- You can go to Portal → Templates → Usage existing usages or add a new template
- In Visual Studio → Cloud → Azure Resource Group → You can select template location (e.g. GitHub) → Select a template
- Deploy a VM then in the last step click on "Download template and parameters"
- You can deploy with PowerShell, Cloud Shell, Azure CLI, or directly from Visual Studio
- You can automate deployment actions such as VM access
- Files
azuredeploy.json
- Deployment template.
- Defines resources and property such as
allowedValues
,defaultValue
- You can refactor some values in variables and reuse in the file
copy
element block in deployment script allows you to create e.g. 3 storages.
azuredeploy.parameters.json
- Deployment parameters (required for deployment) to deploy
azuredeploy.json
- Deployment parameters (required for deployment) to deploy