Service Management Automation: 3,2,1, Automate! This session will cover the base requirements for...

Post on 17-Jan-2016

223 views 0 download

Tags:

Transcript of Service Management Automation: 3,2,1, Automate! This session will cover the base requirements for...

Service Management Automation: 3,2,1, Automate!

This session will cover the base requirements for configuring and installing Service Management Automation. This will include the nuts and bolts of how it to configure, troubleshoot, and the basics of importing and running your runbooks. Walk away ready to automate

Nash Pherson@KidMysticBlog or e-mail address

Steve Jesok@SteveJesokBlog or e-mail address

Speaker picturePersonal picture of your hobby or location picture

#MMSMOA

@KidMystic

Microsoft MVP Enterprise Mobility

MNSCUG Board Member

City, Country

Nash Pherson

Schlepping IT for 12 years….

#MMSMOA

@SteveJesok

Sr Design Engineer

Schlepping IT for 15 years….

MNSCUG Board Member

Minneapolis, United States

Steve Jesok

System Center Orchestration

Automation Tool Primary Function

Orchestrator Orchestrator is intended for automation of all on-premises resources. It uses a different runbook engine than Service Management Automation and Azure Automation.

Service Management Automation Service Management Automation is installed locally in your data center as a component of Windows Azure Pack and is intended to automate management tasks in the private cloud.

Azure Automation Azure Automation runbooks run in the Azure public cloud and are intended to automate Azure-related management tasks.

Service Management Automation SMA

Architecture at a glance…

SMA in 60 minutes

What we need to start

• System Requirements• Install SMA• Create repeatable process, and document them.• Code Versioning• PowerShell ISE

SMA Hardware Recommendations

Hardware recommendations

•Minimum of two cores and 4 GB of RAM for each virtual machine• 60 GB of available disk space• Test with a single system, and use multiple systems with load-balanced incoming traffic for production.

Software Requirements

Software requirements

• Server 2012 R2• PowerShell 4• .Net and IIS Prerequisites• A SQL instance• 2 service accounts, on for the IIS AppPool, on for the Worker

Windows Azure Pack

•Not a requirement, or is it?• A very pretty GUI• Adds additional server requirements•Do you want/need it?• Can be installed quickly (sort of) to try.

http://blogs.technet.com/b/privatecloud/archive/2013/12/06/windows-azure-pack-installing-amp-configuring-series.aspxhttp://rlevchenko.com/2014/11/12/step-by-step-installation-of-windows-azure-pack/

WAP Challenge

The setup can be very challenging…

Installing SMA

#Install the pre-reqs

Install-WindowsFeature Web-Server, Web-Basic-Auth, Web-Windows-Auth, Web-Url-Auth, Web-Asp-Net45, NET-Framework-Core, Net-Framework-45-Core, NET-WCF-HTTP-Activation, Web-Mgmt-Console

#PowerShell Module

msiexec.exe /i PowershellModuleInstaller.msi /L*v C:\SMAPoShModInstaller.log

#WebService

msiexec.exe /i WebServiceInstaller.msi /L*v C:\SMAWebServiceInstaller.log CREATEDATABASE="Yes" SQLSERVER="localhost\SMA" DATABASEAUTHENTICATION="Windows" SQLDATABASE="SMADEV" APPOOLACCOUNT="sma-ap" APPOOLPASSWORD=“Password”

#Worker

msiexec.exe /i WorkerInstaller.msi /L*v C:\SMAWorkerInstaller.log CREATEDATABASE="NO" SQLSERVER="localhost\SMA" DATABASEAUTHENTICATION="Windows" SQLDATABASE="SMADEV" SERVICEACCOUNT="sma-sa" SERVICEPASSWORD=“Password”

https://technet.microsoft.com/en-us/library/dn308244.aspx

First thing, what’s our plan?

Have an approach to what you are doing…

•What do we want to automate?• Standard processes=standard runbooks, naming conventions, etc• Code management• Testing, testing, testing

What to automate first?

Have an approach to measure what you do

•What are the biggest wins?• Very repeatable and measureable. Automate small

repeatable tasks for big gains.• Start with the things you do first!•Get clear requirements when working with other teams.•Document, document, document.

SMA Basics

Assets• Credentials, variables, schedules

Runbooks• The workflows we create

Jobs• The automated work we doModules• Shared code

DemoA walk around the block…

PowerShell SMA Cmdlets#List SMA commands

Get-Command -Module Microsoft.SystemCenter.ServiceManagementAutomation

#Save some time

$sma = "https://server.domain.com"

#List Runbooks

Get-SmaRunbook -WebServiceEndpoint $sma

PowerShell SMA Cmdlets#Credentials

$Credential = Get-Credential

Set-SmaCredential -WebServiceEndpoint $sma -Name SMADemo -Value $Credential -Description "This is the account I am using for this demo"

Get-SMACredential -WebServiceEndpoint $sma

#Variables

Set-SmaVariable -WebServiceEndpoint $sma -Name "SMTP-Server" -Value "Test-Mail.mydomain.com" -Description "This is my mail server"

Set-SmaVariable -WebServiceEndpoint $sma -Name "SMTP-Port" -Value "5150" -Description "This is my mail server port"

Get-SmaVariable -WebServiceEndpoint $sma | Where-Object {$_.Name -like 'SMTP-*'}

#Schedules

$StartDate = "Friday, November 6, 2015 2:00:00 PM"

$EndDate = "Friday, November 13, 2015 2:01:00 PM"

Set-SmaSchedule -WebServiceEndpoint $sma -StartTime $StartDate -ExpiryTime $EndDate -DayInterval 1 -Name "Daily-2:00PM" -ScheduleType "DailySchedule" -Description "A test schedule to demo with"

Get-SmaSchedule -WebServiceEndpoint $sma -Name "Daily-2:00PM"

Test, test, test….

Test your scripts, always!Define testing as part of process documentation, what are specific cases.What to do when the process fails.Pester your scripts.

Version Control with GIT/SouceTree

Visual visual representation of changes.Single or many branches.Rollback when required.Comments on each commit.

https://git-scm.com/download/gui/linux#

DemoBasic GIT versioning

Simplify Commits and Pushes

PowerShell ISE Add-ons• Automate manual tasks• Speed up the process to commit changes, if it’s easy enough you will do it all the time. • Build your own, or find one that work.•One is coming for SMA!

http://social.technet.microsoft.com/wiki/contents/articles/2969.windows-powershell-ise-add-on-tools.aspx

DemoGit Commits

Look in the database

All the data is present…SELECT rb.RunbookName

,rb.LastModifiedTime

,rb.LastModifiedBy

,rbs.[TotalJobCount]

,rbs.[LastStart]

,rbs.[FailedCount]

,rbs.[StoppedCount]

,rbs.[RunningCount]

,rbs.[CompletedCount]

,rbs.[SuspendedCount]

FROM [Stats].[vwRunbookSummary] rbs

inner join [Core].[vwRunbooks] rb on rbs.RunbookId=rb.RunbookId

Where LastStart IS NOT NULL

Reporting!

Will be posted next week! http://mnscug.org/blogs/steve-jesok

Stop, Drop, and Roll….

1. Keep things basic.2. Don’t create elaborate Runbooks.3. Common monitoring, vs individual monitors.4. Build modules for common functions

More on Modules: http://blogs.technet.com/b/orchestrator/archive/2014/06/12/authoring-integration-modules-for-sma.aspx

Resources – Helpful links for getting started

System Req: https://technet.microsoft.com/en-US/library/dn469256.aspx Orchestration Option s: https://technet.microsoft.com/en-us/library/hh237242.aspx Runbook Output Messages: https://technet.microsoft.com/en-us/library/dn919924.aspx CheckPointing: http://blogs.technet.com/b/orchestrator/archive/2014/04/08/service-management-automation-checkpoint-suspend-and-resume-runbooks.aspx Monitoring: http://blogs.technet.com/b/orchestrator/archive/2014/03/18/monitoring-and-troubleshooting-in-service-management-automation.aspx Assets in Depth: http://blogs.technet.com/b/orchestrator/archive/2014/03/05/sma-capabilities-in-depth-assets.aspx David O'Brian SMA via PowerShell DSC: http://www.david-obrien.net/2014/07/deploy-sma-worker-via-powershell-dsc/ PowerShell ISE Add-On: http://social.technet.microsoft.com/wiki/contents/articles/2969.windows-powershell-ise-add-on-tools.aspx Try Azure/OMS Automation too! https://azure.microsoft.com/en-us/documentation/articles/automation-create-runbook-from-samples/

Evaluations: Please provide session feedback by clicking the EVAL button in the scheduler app (also download slides). One lucky winner will receive a free ticket to the next MMS!Session Title:

Discuss…

Ask your questions-real world answers!Plenty of time to engage, share knowledge.

SPO

NSO

RS