Resource groups

The resources in Azure are typically grouped into resource groups. A resource group serves as a container for resources, and you can use role-based access control with it. A common approach is to group similar resources (such as networks, IaaS workloads, PaaS workloads, and so on) into separate resource groups:

# First things first
# Before you can do anything, you need to login
Connect-AzureRmAccount -Subscription 'JHPaaS'

# Listing your subscription's resources
Get-AzureRmResource

# These are as general as they get
$resources = Get-AzureRmResource | Group-Object -Property ResourceType -AsHashTable -AsString
$resources.'Microsoft.Storage/storageAccounts'

# Resource Groups - still pretty general
Get-AzureRmResourceGroup

# Typical IaaS resources

# Storage for Disks, Metrics, etc.
Get-AzureRmStorageAccount

# VNets for your IaaS workloads
Get-AzureRmVirtualNetwork

# Network adapters for your IaaS VMs
Get-AzureRmNetworkInterface

# Public IP adresses for VMs/Load balancers/WAP
Get-AzureRmPublicIpAddress

# The OS offer for your VM
Get-AzureRmVMImagePublisher -Location 'westeurope' |
Where-Object PublisherName -eq 'MicrosoftWindowsServer' |
Get-AzureRmVMImageOffer |
Get-AzureRmVMImageSku |
Get-AzureRmVMImage |
Group-Object -Property Skus, Offer

# A load balancer for multiple VMs - IPv4 addresses are rare!
Get-AzureRmLoadBalancer

# Finally, your VMs
Get-AzureRmVm

Resource groups can be deployed through resource group templates, which are JSON files describing the cloud resources that you are using, as well as the parameters that you are using to create them. Both JSON files can be kept separate from each other, so that the deployment template is independent of the parameters and variables used to populate the template.

This enables you to easily switch between, for example, a development and a production environment, simply by using different parameters. We will see the same approach when we generate configuration data for DSC in the deep dive in Chapter 17, PowerShell Deep Dives.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset