Inside Azure Resource Manager
Michael S. Collier
Cloud Solution Architect,
Microsoft
Level: Intermediate
Michael S. Collier
Cloud Solution Architect
Microsoft
michael.collier@microsoft.com
@MichaelCollier
www.MichaelSCollier.com
http://aka.ms/csablog
http://aka.ms/fundamentalsofazure
Today’s Agenda
1. Current Challenges
2. Basics of Azure Resource Groups & Azure
Resource Manager
3. Role Based Access Control
4. ARM Template Details
Managing Azure Deployments
Azure Service Manager (ASM)
Traditional way to deploy and manage applications hosted in Azure
Production Portal
PowerShell / CLI (default mode)
REST API
Azure Resource Manager (ARM)
Modern way to deploy and manage applications hosted in Azure
Preview “Ibiza” Portal
PowerShell / CLI (ARM mode)
REST API
Azure Resource Management Library for .NET
The Challenge
Deploy/Update logical group
of resources
Visualize related resources:
Provision/Deprovision
Costs
Security/Permissions
????
Single Resource Point-of-View
Deployment – complex.
Coordinated deployment?
Communication/configuration between resources?
Single Resource Point-of-View
AZURE RESOURCE GROUPS
The Foundation
Azure Resource Groups
Lifecycle of application and
resources
Declarative
Consistent Management API
Azure Resource Manager
What is Azure Resource Manager?
Unit of Management
• Lifecycle
• Identity
• Grouping
One Resource -> One Resource Group
Resource Groups
One or Many?
How are the resources managed?
Consistent Management Layer
Resource
Provider
https://management.azure.com/subscriptions/{{subscriptionId}}/provide
rs?api-version={{apiVersion}}
?
REST API
Benefits
Desired-state deployment
Faster deployment
Role-based access control (RBAC)
Resource-provider model
Orchestration
Resource configuration
SQL - A Website Virtual
Machines
SQL-A
Website
[SQL CONFIG] VM (2x)
DEPENDS ON SQLDEPENDS ON SQL
SQLCONFIG
Image source - http://channel9.msdn.com/Events/Build/2014/2-607
Why
• Internal software development teams
– Quickly deploy technologies
– Rapidly create training environments
– Consistent deployment with enforced constraints
• Corporate IT
– Predefined environments for dev, QA, or production
– Provide LOB solutions
• ISV/CSV
– Hosting a solution for customers
– Inject solution into customer’s subscription
– Sell via Azure Marketplace
• Community / OSS
– Host on GitHub to allow community to share and improve.
?
DEMO
Browse the Azure Preview Portal
Browse the Azure Preview Portal
ARM Definitions
Resource: Atomic unit of deployment
Resource Group: Collection of resources
Resource Provider: Manages specific kinds of
resources
Resource Type: Specifies the type of resource
Resource Providers
Deploy specific types of resources
Identified by provider namespace
e.g., Microsoft.Compute, Microsoft.Storage, Microsoft.Web (~ 25 Microsoft or customer
namespaces)
Resource types
Each provider namespace manages one or more resource types
Microsoft.Compute/availabiltySets
Microsoft.Compute/virtualMachines
Microsoft.Compute/locations
Different regional availability and apiVersion
Resource Providers - PowerShell
Get-AzureLocation indicates which resourceTypes
are available in each region
Get-AzureProvider indicates which resource
providers and apiVersions are available in each region.
22
(Get-AzureProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where {
$_.ResourceTypeName -eq 'storageAccounts' } | Select –ExpandProperty ApiVersions
(Get-AzureProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where {
$_.ResourceTypeName -eq 'storageAccounts' } | Select -ExpandProperty Locations
Resource Group Definition
Name
Unique inside a subscription
Id
Unique across Azure
Location
Resources
Set of resources in the resource group
Tags
Resource group can be tagged to provide (billing) metadata
Resource Group Definition
PS C:> New-AzureResourceGroup -Name VSLiveNYC -Location "East US" -Tag @{Name=“Event"; Value=“VSLIVE"},
@{Name="Admin";Value="mcollier"}
VERBOSE: 9:52:35 PM - Created resource group ‘VSLiveNYC' in location 'eastus'
ResourceGroupName : VSLiveNYC
Location : eastus
ProvisioningState : Succeeded
Tags :
Name Value
========= ========
Event VSLIVE
Admin mcollier
Permissions :
Actions NotActions
======= ==========
*
ResourceId : /subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/VSLiveNYC
Resource Group Definition
C:UsersMCOLLIER>azure
info: _ _____ _ ___ ___
info: /_ |_ / | | | _  __|
info: _ ___/ _ __/ /| |_| | / _|___ _ _
info: (___ /_/ _/___|___/|_|____| _____)
info: (_______ _ _) _ ______ _)_ _
info: (______________ _ ) (___ _ _)
info:
info: Microsoft Azure: Microsoft's Cloud Platform
info:
info: Tool version 0.9.9
help:
help: Display help for a given command
help: help [options] [command]
help:
help: Log in to an Azure subscription using Active Directory. Currently, the user can login only via Microsoft organizational account
help: login [options] [username]
help:
help: Log out from Azure subscription using Active Directory. Currently, the user can log out only via Microsoft organizational account
help: logout [options] [username]
help:
help: Open the portal in a browser
help: portal [options]
help:
help: Commands:
help: account Commands to manage your account information and publish settings
help: config Commands to manage your local settings
help: hdinsight Commands to manage HDInsight clusters and jobs
help: mobile Commands to manage your Mobile Services
help: network Commands to manage your networks
help: sb Commands to manage your Service Bus configuration
help: service Commands to manage your Cloud Services
help: site Commands to manage your Web Sites
help: sql Commands to manage your SQL Server accounts
help: storage Commands to manage your Storage objects
help: vm Commands to manage your Virtual Machines
help:
help: Options:
help: -h, --help output usage information
help: -v, --version output the application version
help:
help: Current Mode: asm (Azure Service Management)
Resource Group Definition
C:UsersMCOLLIER>C:UsersMCOLLIER>azure login admin@mcollier.onmicrosoft.com
info: Executing command login
Password: ********
/info: Added subscription Visual Studio Ultimate with MSDN (Microsoft FTE)
info: Setting subscription "Visual Studio Ultimate with MSDN (Microsoft FTE)" as default
+
info: login command OK
C:UsersMCOLLIER>azure config mode arm
info: New mode is arm
C:C:UsersMCOLLIER>azure group create -n "vslivenyc2015-cli" -l "East US" -t event=vslive;admin=mcollier
info: Executing command group create
+ Getting resource group vslivenyc2015-cli
+ Creating resource group vslivenyc2015-cli
info: Created resource group vslivenyc2015-cli
data: Id: /subscriptions/0bbbc191-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/vslivenyc2015-cli
data: Name: vslivenyc2015-cli
data: Location: eastus
data: Provisioning State: Succeeded
data: Tags: event=vslive;admin=mcollier
data:
info: group create command OK
C:UsersMCOLLIER>
Resource Characteristics
Resource group
Resource exists in precisely one resource group at any time
Resource can be moved from one resource group to another
Location
Resource can be created in any region where there is an a
appropriate resource provider
Locks
Resource can be locked to prevent deletion
Tags
Resource can be tagged to provide (billing) metadata
Resource Group Characteristics
Two types of resource groups
Lifecycle
Shared
Lifecyle
Contains resources with common lifecycle and management
e.g., virtual machines and storage accounts for an application
Shared
Contains resources shared among several resource groups
e.g., VNETs used to host VMs from many applications
Resource Definition
Name
Unique for resource group and resource type (e.g.,
Microsoft.Compute/virtualMachines)
Id
Unique across Azure
/subscriptions/GUID/resourceGroups/myRG/providers/Microsoft.Compute/virtua
lMachines/vmName
Location
ResourceType
ResourceGroup
Properties
Additional properties specific to the resource provider
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('newStorageAccountName')]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "StorageAccount"
},
"properties": {
"accountType": "[variables('storageAccountType')]"
}
}
Resource Tags
Tag
Name/value pair
Provides metadata to classify resources and resource
groups
Resources and resource groups
An array of tags can be associated with a resource or a
resource group
Billing
Tags are surfaced to Azure bills so they can be used in
allocating resource costs
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/availabilitySets",
"name": "[variables('availabilitySetName')]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "AvailabilitySet"
}
}
> New-AzureResourceGroup -Name VSLiveNYC -Location "East
US" -Tag @{Name=“Event"; Value=“VSLive"},
@{Name="Admin";Value="mcollier"}
Resource Locks
Prevents deletion of a resource or
resource group
Associate a resource lock with the resource or
resource group
Only the Owner or User Access Administrator
roles can create or modify locks
Resource Locks
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('newStorageAccountName')]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('location')]",
"properties": {
"accountType": "[parameters('storageAccountType')]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/providers/locks",
"name": "[concat(parameters('newStorageAccountName'), '/Microsoft.Authorization/collierLock')]",
"apiVersion": "2015-01-01",
"dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]" ],
"properties": {
"level": "CannotDelete",
"notes": "Mike's important files - do not delete!"
}
} ]
} ]
Options: CannotDelete and ReadOnly*
Name of the lock
Resource Locks
# Apply a resource lock to the storage account.
New-AzureResourceLock -LockLevel CanNotDelete `
-LockNotes 'No deleting!' `
-LockName 'CollierLock' `
-ResourceName $storageAccountName `
-ResourceType 'Microsoft.Storage/storageAccounts' `
-ResourceGroup $resourceGroup –Verbose
# Apply a resource lock to an entire resource group
New-AzureResourceLock -LockLevel CanNotDelete `
-LockNotes 'No deleting!' `
-LockName 'CollierGroupLock' `
-ResourceGroup 'CollierMedia' -Verbose
Resource Locks
More information:
https://michaelscollier.com/2015/06/21/lock-
down-your-azure-resources/
ROLE BASED ACCESS CONTROL
Azure Resource Groups
Motivation
ASM
Admins, co-admins and X.509 certs
No RBAC
Pushback from enterprises
Azure Active Directory
Cloud-scale directory service
ARM
AAD
RBAC
RBAC
Assign an AAD identity to a role at some scope
ARM mode
Role
Specifies a set of Actions and NotActions
Contains zero or more AAD identities
37
RBAC Scope
Know Your Role
Core system roles
Owner
Contributor
Reader
Security Manager
User Access Administrator
Resource-based roles
Virtual Machine Contributor
SQL Server Contributor
… (currently 20)
Custom roles
Announced at Ignite 2015
Know Your Role
Assign via PowerShell
New-AzureRoleAssignment
Remove-AzureRoleAssignment
Get-AzureRoleAssignment
Get-AzureRoleDefinition
New-AzureRoleAssignment `
-UserPrincipalName user@somedomain.com `
-RoleDefinitionName Reader `
-Scope
/subscriptions/GUID/resourceGroups/SomeResourceGroupName
Know Your Role
Assign via Azure Preview Portal
Know Your Role
Assign via Azure Preview Portal
Know Your Role
Assign via Azure Preview Portal
Know Your Role
Assign via Azure Preview Portal
Role Actions
Switch-AzureMode -Name AzureResourceManager
$roles = Get-AzureRoleDefinition #| where { $_.Name -like "SQL*"}
foreach ($def in $roles) {
Write-Host 'Role: '$def.Name
Write-Host 'Actions'
(Get-AzureRoleDefinition -Name $def.Name).Actions
Write-Host 'NotActions'
(Get-AzureRoleDefinition -Name $def.Name).NotActions
Write-Host ([Environment]::NewLine)
}
ARM TEMPLATES
Features and Deployment
ARM Deployment Options
ARM Templates
Desired-state deployment for a single resource group
Parameterized JSON template
Resources deployed in parallel
Resource dependency constraints enforced
Template language provides some built-in functions
ARM Deployment Options
> Switch-AzureMode
AzureResourceManager
* https://github.com/Azure/azure-
powershell/wiki/Deprecation-of-
Switch-AzureMode-in-Azure-
PowerShell
Azure PowerShell
azure config mode arm
Azure XPlat CLI
Azure Marketplace
Resource Manager stack
Azure Preview Portal
https://github.com/Azure/azure-quickstart-
templates
http://deploy.azure.com
Deploy To Azure
ARM mode
Resource-specific cmdlets
Template-deployment cmdlets
ARM Templates
Template file comprises several sections
parameters – parameterizes the deployment of a template
variables – provides variables used in the definition of resources
resources – specifies a goal state for a set of resources in a resource group
outputs – provides values to be returned from the template
Parameter file provides actual values for parameters
Goal state
Parameterized template provides the goal state for a resource group
Resource group specified at runtime
ARM Functions
ARM Templates supports small set of built-in functions
parameters, variables
reference, resourceGroup, resourceId
base64, concat, padLeft, padLeft, replace, toLower, toUpper
deployment, provider, subscription
listKeys
Not supported
User-defined functions
Control constructs – if, while, etc.
Loops and Nested Templates
Loops
Provide basic copy capability
Useful in cloning resource configuration
For example, deploying multiple VMs
Nested Templates
One template can invoke another
Simplifies creation of sophisticated templates
Supports parameters
Supports output variables
ARM Deployment Logs
Logs
Provider
Resource group
Resource
Availability
Kept for 15 days
Default is last hour (PowerShell)
Filter by Status e.g., Failed
PowerShell
Get-AzureResourceProviderLog
Get-AzureResourceGroupLog
Get-AzureResourceLog
DEMO
Explore and Deploy an ARM template
Inside vs. Outside the box
ARM Template
State Configuration /
Extensions
Inside vs. Outside the box
• Outside – part of the template
– VM, network topology, tags, RBAC, references to
certs/secrets, etc.
• Inside – executed by template only
– Configure server roles, configure software, deploy a
website, manage services, manage local users, etc.
– Extensions for PowerShell DSC, Chef, and Puppet.
Free Form . . . Ideal?
User selects arbitrary configuration
Number of nodes, VM sizes, disks, storage accounts, etc.
Maintenance overhead
Support for an undetermined number of configs
Subscription management
Resource limits per subscription
Density challenge – set aside capacity for potential use
Subscription creation cannot be automated
Known Configuration
T-Shirt Sizing
Size: Small, Medium, Large
Product/Audience: Community, Enterprise
Feature: Basic, High Availability
Flexibility within size to select number of resources (to
max)
Known sizing – known resources
Template Decomposition
59
Parameters
adminUserName
adminPassword
storageAccountName
region
virtualNetworkName
addressPrefix
subnetName
subnetPrefix
jumpbox
tshirtSize
osFamily
Template Metadata
Main Template
Known Configuration
Resources Template
Shared Resources Template
Widely Reusable Script(s)
Custom ScriptsMember Resources
Template(s)
Optional Resource
Template(s)
Image: https://azure.microsoft.com/en-us/documentation/articles/best-practices-resource-manager-design-templates/#identifying-what-is-outside-and-inside-of-a-vm
DEMO
Advanced ARM template
Summary
Application Lifecycle Management
Provision & deprovision resources for an application as a logical unit
Declarative
Rapid, repeatable deployment
Save application topology
Consistent Management API
Uniform REST API
Portal, Command Line, PowerShell, Visual Studio or other tools
ARM is the future of resource management in Azure
Resources
ARM Template Examples
– https://github.com/azure/azure-quickstart-templates
Best Practices for Designing Azure Resource Manager Templates
https://azure.microsoft.com/en-us/documentation/articles/best-practices-resource-manager-design-templates/
Rest API Reference
http://msdn.microsoft.com/en-us/library/azure/dn790568.aspx
ARM Template Functions
https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-functions/
Azure Resource Explorer
https://resources.azure.com/
Microsoft Cloud Solution Architect Blog
http://aka.ms/csablog/
Questions?
Thank You!
Michael S. Collier
@MichaelCollier | www.michaelscollier.com
michael.collier@microsoft.com

Inside Azure Resource Manager

  • 1.
    Inside Azure ResourceManager Michael S. Collier Cloud Solution Architect, Microsoft Level: Intermediate
  • 2.
    Michael S. Collier CloudSolution Architect Microsoft [email protected] @MichaelCollier www.MichaelSCollier.com http://aka.ms/csablog
  • 3.
  • 4.
    Today’s Agenda 1. CurrentChallenges 2. Basics of Azure Resource Groups & Azure Resource Manager 3. Role Based Access Control 4. ARM Template Details
  • 5.
    Managing Azure Deployments AzureService Manager (ASM) Traditional way to deploy and manage applications hosted in Azure Production Portal PowerShell / CLI (default mode) REST API Azure Resource Manager (ARM) Modern way to deploy and manage applications hosted in Azure Preview “Ibiza” Portal PowerShell / CLI (ARM mode) REST API Azure Resource Management Library for .NET
  • 6.
    The Challenge Deploy/Update logicalgroup of resources Visualize related resources: Provision/Deprovision Costs Security/Permissions ????
  • 7.
    Single Resource Point-of-View Deployment– complex. Coordinated deployment? Communication/configuration between resources?
  • 8.
  • 9.
  • 10.
    Azure Resource Groups Lifecycleof application and resources Declarative Consistent Management API
  • 11.
    Azure Resource Manager Whatis Azure Resource Manager? Unit of Management • Lifecycle • Identity • Grouping One Resource -> One Resource Group
  • 12.
    Resource Groups One orMany? How are the resources managed?
  • 13.
  • 14.
    Benefits Desired-state deployment Faster deployment Role-basedaccess control (RBAC) Resource-provider model Orchestration Resource configuration SQL - A Website Virtual Machines SQL-A Website [SQL CONFIG] VM (2x) DEPENDS ON SQLDEPENDS ON SQL SQLCONFIG Image source - http://channel9.msdn.com/Events/Build/2014/2-607
  • 15.
    Why • Internal softwaredevelopment teams – Quickly deploy technologies – Rapidly create training environments – Consistent deployment with enforced constraints • Corporate IT – Predefined environments for dev, QA, or production – Provide LOB solutions • ISV/CSV – Hosting a solution for customers – Inject solution into customer’s subscription – Sell via Azure Marketplace • Community / OSS – Host on GitHub to allow community to share and improve. ?
  • 16.
    DEMO Browse the AzurePreview Portal Browse the Azure Preview Portal
  • 17.
    ARM Definitions Resource: Atomicunit of deployment Resource Group: Collection of resources Resource Provider: Manages specific kinds of resources Resource Type: Specifies the type of resource
  • 18.
    Resource Providers Deploy specifictypes of resources Identified by provider namespace e.g., Microsoft.Compute, Microsoft.Storage, Microsoft.Web (~ 25 Microsoft or customer namespaces) Resource types Each provider namespace manages one or more resource types Microsoft.Compute/availabiltySets Microsoft.Compute/virtualMachines Microsoft.Compute/locations Different regional availability and apiVersion
  • 19.
    Resource Providers -PowerShell Get-AzureLocation indicates which resourceTypes are available in each region Get-AzureProvider indicates which resource providers and apiVersions are available in each region. 22 (Get-AzureProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where { $_.ResourceTypeName -eq 'storageAccounts' } | Select –ExpandProperty ApiVersions (Get-AzureProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where { $_.ResourceTypeName -eq 'storageAccounts' } | Select -ExpandProperty Locations
  • 20.
    Resource Group Definition Name Uniqueinside a subscription Id Unique across Azure Location Resources Set of resources in the resource group Tags Resource group can be tagged to provide (billing) metadata
  • 21.
    Resource Group Definition PSC:> New-AzureResourceGroup -Name VSLiveNYC -Location "East US" -Tag @{Name=“Event"; Value=“VSLIVE"}, @{Name="Admin";Value="mcollier"} VERBOSE: 9:52:35 PM - Created resource group ‘VSLiveNYC' in location 'eastus' ResourceGroupName : VSLiveNYC Location : eastus ProvisioningState : Succeeded Tags : Name Value ========= ======== Event VSLIVE Admin mcollier Permissions : Actions NotActions ======= ========== * ResourceId : /subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/VSLiveNYC
  • 22.
    Resource Group Definition C:UsersMCOLLIER>azure info:_ _____ _ ___ ___ info: /_ |_ / | | | _ __| info: _ ___/ _ __/ /| |_| | / _|___ _ _ info: (___ /_/ _/___|___/|_|____| _____) info: (_______ _ _) _ ______ _)_ _ info: (______________ _ ) (___ _ _) info: info: Microsoft Azure: Microsoft's Cloud Platform info: info: Tool version 0.9.9 help: help: Display help for a given command help: help [options] [command] help: help: Log in to an Azure subscription using Active Directory. Currently, the user can login only via Microsoft organizational account help: login [options] [username] help: help: Log out from Azure subscription using Active Directory. Currently, the user can log out only via Microsoft organizational account help: logout [options] [username] help: help: Open the portal in a browser help: portal [options] help: help: Commands: help: account Commands to manage your account information and publish settings help: config Commands to manage your local settings help: hdinsight Commands to manage HDInsight clusters and jobs help: mobile Commands to manage your Mobile Services help: network Commands to manage your networks help: sb Commands to manage your Service Bus configuration help: service Commands to manage your Cloud Services help: site Commands to manage your Web Sites help: sql Commands to manage your SQL Server accounts help: storage Commands to manage your Storage objects help: vm Commands to manage your Virtual Machines help: help: Options: help: -h, --help output usage information help: -v, --version output the application version help: help: Current Mode: asm (Azure Service Management)
  • 23.
    Resource Group Definition C:UsersMCOLLIER>C:UsersMCOLLIER>azurelogin [email protected] info: Executing command login Password: ******** /info: Added subscription Visual Studio Ultimate with MSDN (Microsoft FTE) info: Setting subscription "Visual Studio Ultimate with MSDN (Microsoft FTE)" as default + info: login command OK C:UsersMCOLLIER>azure config mode arm info: New mode is arm C:C:UsersMCOLLIER>azure group create -n "vslivenyc2015-cli" -l "East US" -t event=vslive;admin=mcollier info: Executing command group create + Getting resource group vslivenyc2015-cli + Creating resource group vslivenyc2015-cli info: Created resource group vslivenyc2015-cli data: Id: /subscriptions/0bbbc191-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/vslivenyc2015-cli data: Name: vslivenyc2015-cli data: Location: eastus data: Provisioning State: Succeeded data: Tags: event=vslive;admin=mcollier data: info: group create command OK C:UsersMCOLLIER>
  • 24.
    Resource Characteristics Resource group Resourceexists in precisely one resource group at any time Resource can be moved from one resource group to another Location Resource can be created in any region where there is an a appropriate resource provider Locks Resource can be locked to prevent deletion Tags Resource can be tagged to provide (billing) metadata
  • 25.
    Resource Group Characteristics Twotypes of resource groups Lifecycle Shared Lifecyle Contains resources with common lifecycle and management e.g., virtual machines and storage accounts for an application Shared Contains resources shared among several resource groups e.g., VNETs used to host VMs from many applications
  • 26.
    Resource Definition Name Unique forresource group and resource type (e.g., Microsoft.Compute/virtualMachines) Id Unique across Azure /subscriptions/GUID/resourceGroups/myRG/providers/Microsoft.Compute/virtua lMachines/vmName Location ResourceType ResourceGroup Properties Additional properties specific to the resource provider { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Storage/storageAccounts", "name": "[parameters('newStorageAccountName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "StorageAccount" }, "properties": { "accountType": "[variables('storageAccountType')]" } }
  • 27.
    Resource Tags Tag Name/value pair Providesmetadata to classify resources and resource groups Resources and resource groups An array of tags can be associated with a resource or a resource group Billing Tags are surfaced to Azure bills so they can be used in allocating resource costs { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Compute/availabilitySets", "name": "[variables('availabilitySetName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "AvailabilitySet" } } > New-AzureResourceGroup -Name VSLiveNYC -Location "East US" -Tag @{Name=“Event"; Value=“VSLive"}, @{Name="Admin";Value="mcollier"}
  • 28.
    Resource Locks Prevents deletionof a resource or resource group Associate a resource lock with the resource or resource group Only the Owner or User Access Administrator roles can create or modify locks
  • 29.
    Resource Locks "resources": [ { "type":"Microsoft.Storage/storageAccounts", "name": "[parameters('newStorageAccountName')]", "apiVersion": "2015-05-01-preview", "location": "[parameters('location')]", "properties": { "accountType": "[parameters('storageAccountType')]" }, "resources": [ { "type": "Microsoft.Storage/storageAccounts/providers/locks", "name": "[concat(parameters('newStorageAccountName'), '/Microsoft.Authorization/collierLock')]", "apiVersion": "2015-01-01", "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]" ], "properties": { "level": "CannotDelete", "notes": "Mike's important files - do not delete!" } } ] } ] Options: CannotDelete and ReadOnly* Name of the lock
  • 30.
    Resource Locks # Applya resource lock to the storage account. New-AzureResourceLock -LockLevel CanNotDelete ` -LockNotes 'No deleting!' ` -LockName 'CollierLock' ` -ResourceName $storageAccountName ` -ResourceType 'Microsoft.Storage/storageAccounts' ` -ResourceGroup $resourceGroup –Verbose # Apply a resource lock to an entire resource group New-AzureResourceLock -LockLevel CanNotDelete ` -LockNotes 'No deleting!' ` -LockName 'CollierGroupLock' ` -ResourceGroup 'CollierMedia' -Verbose
  • 31.
  • 32.
    ROLE BASED ACCESSCONTROL Azure Resource Groups
  • 33.
    Motivation ASM Admins, co-admins andX.509 certs No RBAC Pushback from enterprises Azure Active Directory Cloud-scale directory service ARM AAD RBAC
  • 34.
    RBAC Assign an AADidentity to a role at some scope ARM mode Role Specifies a set of Actions and NotActions Contains zero or more AAD identities 37
  • 35.
  • 36.
    Know Your Role Coresystem roles Owner Contributor Reader Security Manager User Access Administrator Resource-based roles Virtual Machine Contributor SQL Server Contributor … (currently 20) Custom roles Announced at Ignite 2015
  • 37.
    Know Your Role Assignvia PowerShell New-AzureRoleAssignment Remove-AzureRoleAssignment Get-AzureRoleAssignment Get-AzureRoleDefinition New-AzureRoleAssignment ` -UserPrincipalName [email protected] ` -RoleDefinitionName Reader ` -Scope /subscriptions/GUID/resourceGroups/SomeResourceGroupName
  • 38.
    Know Your Role Assignvia Azure Preview Portal
  • 39.
    Know Your Role Assignvia Azure Preview Portal
  • 40.
    Know Your Role Assignvia Azure Preview Portal
  • 41.
    Know Your Role Assignvia Azure Preview Portal
  • 42.
    Role Actions Switch-AzureMode -NameAzureResourceManager $roles = Get-AzureRoleDefinition #| where { $_.Name -like "SQL*"} foreach ($def in $roles) { Write-Host 'Role: '$def.Name Write-Host 'Actions' (Get-AzureRoleDefinition -Name $def.Name).Actions Write-Host 'NotActions' (Get-AzureRoleDefinition -Name $def.Name).NotActions Write-Host ([Environment]::NewLine) }
  • 43.
  • 44.
    ARM Deployment Options ARMTemplates Desired-state deployment for a single resource group Parameterized JSON template Resources deployed in parallel Resource dependency constraints enforced Template language provides some built-in functions
  • 45.
    ARM Deployment Options >Switch-AzureMode AzureResourceManager * https://github.com/Azure/azure- powershell/wiki/Deprecation-of- Switch-AzureMode-in-Azure- PowerShell Azure PowerShell azure config mode arm Azure XPlat CLI Azure Marketplace Resource Manager stack Azure Preview Portal https://github.com/Azure/azure-quickstart- templates http://deploy.azure.com Deploy To Azure ARM mode Resource-specific cmdlets Template-deployment cmdlets
  • 46.
    ARM Templates Template filecomprises several sections parameters – parameterizes the deployment of a template variables – provides variables used in the definition of resources resources – specifies a goal state for a set of resources in a resource group outputs – provides values to be returned from the template Parameter file provides actual values for parameters Goal state Parameterized template provides the goal state for a resource group Resource group specified at runtime
  • 47.
    ARM Functions ARM Templatessupports small set of built-in functions parameters, variables reference, resourceGroup, resourceId base64, concat, padLeft, padLeft, replace, toLower, toUpper deployment, provider, subscription listKeys Not supported User-defined functions Control constructs – if, while, etc.
  • 48.
    Loops and NestedTemplates Loops Provide basic copy capability Useful in cloning resource configuration For example, deploying multiple VMs Nested Templates One template can invoke another Simplifies creation of sophisticated templates Supports parameters Supports output variables
  • 49.
    ARM Deployment Logs Logs Provider Resourcegroup Resource Availability Kept for 15 days Default is last hour (PowerShell) Filter by Status e.g., Failed PowerShell Get-AzureResourceProviderLog Get-AzureResourceGroupLog Get-AzureResourceLog
  • 50.
    DEMO Explore and Deployan ARM template
  • 51.
    Inside vs. Outsidethe box ARM Template State Configuration / Extensions
  • 52.
    Inside vs. Outsidethe box • Outside – part of the template – VM, network topology, tags, RBAC, references to certs/secrets, etc. • Inside – executed by template only – Configure server roles, configure software, deploy a website, manage services, manage local users, etc. – Extensions for PowerShell DSC, Chef, and Puppet.
  • 53.
    Free Form .. . Ideal? User selects arbitrary configuration Number of nodes, VM sizes, disks, storage accounts, etc. Maintenance overhead Support for an undetermined number of configs Subscription management Resource limits per subscription Density challenge – set aside capacity for potential use Subscription creation cannot be automated
  • 54.
    Known Configuration T-Shirt Sizing Size:Small, Medium, Large Product/Audience: Community, Enterprise Feature: Basic, High Availability Flexibility within size to select number of resources (to max) Known sizing – known resources
  • 55.
    Template Decomposition 59 Parameters adminUserName adminPassword storageAccountName region virtualNetworkName addressPrefix subnetName subnetPrefix jumpbox tshirtSize osFamily Template Metadata MainTemplate Known Configuration Resources Template Shared Resources Template Widely Reusable Script(s) Custom ScriptsMember Resources Template(s) Optional Resource Template(s) Image: https://azure.microsoft.com/en-us/documentation/articles/best-practices-resource-manager-design-templates/#identifying-what-is-outside-and-inside-of-a-vm
  • 56.
  • 57.
    Summary Application Lifecycle Management Provision& deprovision resources for an application as a logical unit Declarative Rapid, repeatable deployment Save application topology Consistent Management API Uniform REST API Portal, Command Line, PowerShell, Visual Studio or other tools ARM is the future of resource management in Azure
  • 58.
    Resources ARM Template Examples –https://github.com/azure/azure-quickstart-templates Best Practices for Designing Azure Resource Manager Templates https://azure.microsoft.com/en-us/documentation/articles/best-practices-resource-manager-design-templates/ Rest API Reference http://msdn.microsoft.com/en-us/library/azure/dn790568.aspx ARM Template Functions https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-functions/ Azure Resource Explorer https://resources.azure.com/ Microsoft Cloud Solution Architect Blog http://aka.ms/csablog/
  • 59.
  • 60.
    Thank You! Michael S.Collier @MichaelCollier | www.michaelscollier.com [email protected]

Editor's Notes

  • #7 Introduce the two ways to manage Azure services. ASM has been around since 2009 and is getting long in the tooth. ARM supports modern deployment practices. It is designed to be extensible to all current and future services.
  • #8 Let’s talk about the challenge we have when deploying Azure-based solutions . . . The multiple resources needed.
  • #10 Single resource – not so bad. Multiple resources – gets to be more of a challenge. Need to coordinate the deployment so that dependencies are handled (e.g. DB before web so that configuration string can be set).
  • #14 Lifecycle of application and related resources
  • #15 Resource - an Azure entity such as a VM, WebSite, Storage Account, SQL Database Resource Group Collection of Azure resources Every Resource must exist in one, and only one, Resource Group Unit of Management Lifecyle - deployment, update, delete, obtain status Grouping - Billing
  • #17 https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Sql/servers/{{server}}/databases/{{database}}?api-version={{apiVersion}}
  • #18 Repeatedly provision resources
  • #19 Constraints – RBAC to prevent developer from changing solution to send data to personal storage account
  • #20 Show resource groups in the Azure Preview Portal (quick).
  • #22 (Get-AzureProvider -ProviderNamespace Microsoft.Compute).ResourceTypes
  • #47 Contributor is one of the few roles with NotActions. Note that Contributor cannot lock resources
  • #53 https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-functions/
  • #55 Open a template in Visual Studio. Show various sections of the template (parameters, variables, resources, etc.). Deploy via PowerShell
  • #57 ARM templates are for control things outside the VM – the VM itself and resources related to the deployment. Inside – installed software and overall desired state. Scripts are executed by the ARM template but aren’t contained within the template itself. DSC extensions can help to control “drift”.
  • #61 Walkthrough the template at https://github.com/Azure/azure-quickstart-templates/blob/master/postgresql-on-ubuntu/azuredeploy.json