Home

Automatically Enable Azure Security Center Standard Tier for new Subscriptions

%3CLINGO-SUB%20id%3D%22lingo-sub-285621%22%20slang%3D%22en-US%22%3EAutomatically%20Enable%20Azure%20Security%20Center%20Standard%20Tier%20for%20new%20Subscriptions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-285621%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20article%20describes%20the%20steps%20for%20a%20scenario%20where%20Azure%20Security%20Center%20Standard%20tier%20needs%20to%20be%20automatically%20enabled%20for%20all%20new%20subscriptions.%20To%20enable%20this%20scenario%20the%20following%20components%20will%20be%20used%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20Management%20Groups%3C%2FLI%3E%0A%3CLI%3EAzure%20Automation%20Account%3C%2FLI%3E%0A%3CLI%3EAzure%20Security%20Center%20PowerShell%20modules%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIn%20this%20scenario%2C%20all%20new%20subscriptions%20that%20are%20created%20under%20the%20Enterprise%20Management%20Group%20will%20automatically%20have%20Azure%20Security%20Center%20standard%20tier%20enabled%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20574px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59568i4C0EB8919E62612F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig0.JPG%22%20title%3D%22Fig0.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20Azure%20automation%20account%20will%20be%20running%20every%20hour%20(it%20could%20be%20less%20according%20to%20your%20business%20needs)%20and%20if%20identifies%20a%20new%20subscription%20that%20has%20Security%20Center%20Free%20tier%2C%20it%20will%20upgrade%20to%20Standard.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EImplementation%20steps%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIn%20Azure%20Portal%2C%20click%20%3CSTRONG%3EAutomation%20Accounts%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAdd%3C%2FSTRONG%3E%20and%20the%20%3CSTRONG%3EAdd%20Automation%20Account%3C%2FSTRONG%3E%20blade%20appears%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20323px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59567iCC3B365786A11F8A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig1.JPG%22%20title%3D%22Fig1.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3EType%20the%20name%20of%20the%20Automation%20Account%2C%20select%20the%20subscription%2C%20the%20Resource%20Group%20and%20the%20Location.%20Make%20sure%20the%20option%20%3CSTRONG%3EYes%3C%2FSTRONG%3E%20is%20selected%20under%20%3CSTRONG%3ECreate%20Azure%20Run%20As%20account%3C%2FSTRONG%3E%20and%20click%20%3CSTRONG%3ECreate%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3CLI%3EThe%20new%20automation%20account%20will%20appear%20in%20the%20list%2C%20click%20on%20it%20to%20edit.%3C%2FLI%3E%0A%3CLI%3EUnder%20%3CSTRONG%3EShared%20Resources%3C%2FSTRONG%3E%20section%2C%20click%20%3CSTRONG%3EModules%3C%2FSTRONG%3E%20and%20click%20%3CSTRONG%3EUpdate%20Azure%20modules%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20625px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59569i943FA0AF95BBD48F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig2.JPG%22%20title%3D%22Fig2.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%226%22%3E%0A%3CLI%3EYou%20may%20receive%20a%20warning%20like%20the%20one%20below%2C%20click%20%3CSTRONG%3EYes%3C%2FSTRONG%3E%20to%20proceed.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59570iC14774E2AD88D2C1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig3.JPG%22%20title%3D%22Fig3.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%227%22%3E%0A%3CLI%3EWait%20until%20you%20see%20the%20description%20that%20the%20modules%20were%20updated%2C%20as%20shown%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20317px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59571i36966B7EE0B9C5B8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig4.JPG%22%20title%3D%22Fig4.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%228%22%3E%0A%3CLI%3EOpen%20a%20new%20tab%20in%20your%20browser%20and%20navigate%20the%20following%20URL%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fna01.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fwww.powershellgallery.com%252Fpackages%252FAzureRM.Security%252F0.2.0-preview%26amp%3Bdata%3D02%257C01%257Cyurid%2540microsoft.com%257C0408a32becaf4a80651a08d644221657%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C636771310540408779%26amp%3Bsdata%3DODXkvlo7IAs%252BPFQHhZBv4tMISMJk7%252F%252BKWu1gHAAQZXc%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAzureRM.Security%2F0.2.0-preview%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%229%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAzure%20Automation%3C%2FSTRONG%3E%20tab%20and%20click%20Deploy%20to%20%3CSTRONG%3EAzure%20Automation%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20780px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59572i9568652C0B151EFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig5.JPG%22%20title%3D%22Fig5.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%2210%22%3E%0A%3CLI%3EOn%20the%20new%20blade%20that%20opens%2C%20under%20%3CSTRONG%3EAutomation%20Account%3C%2FSTRONG%3E%20option%2C%20select%20the%20Azure%20Automation%20Account%20that%20you%20are%20creating%20in%20this%20article%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20308px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59573i2BAF2E33AF81162C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig6.JPG%22%20title%3D%22Fig6.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%2211%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3EOK%3C%2FSTRONG%3E%20button%2C%20and%20once%20the%20%3CSTRONG%3EOK%3C%2FSTRONG%3E%20button%20becomes%20gray%20out%2C%20close%20the%20blade.%3C%2FLI%3E%0A%3CLI%3EGo%20back%20to%20the%20previous%20tab%2C%20where%20you%20have%20the%20automation%20account%20properties%2C%20and%20click%20%3CSTRONG%3EConnections%3C%2FSTRONG%3E%20under%20%3CSTRONG%3EShared%20Resources%3C%2FSTRONG%3E%20section%2C%20and%20select%20%3CSTRONG%3EAzureRunAsConnection%3C%2FSTRONG%3E%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20840px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59574i60E15154E5FBE6AA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig7.JPG%22%20title%3D%22Fig7.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%2213%22%3E%0A%3CLI%3ECopy%20the%20%3CSTRONG%3EApplicationID%3C%2FSTRONG%3E%20to%20the%20clipboard.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20this%20%3CEM%3EApplicationID%3C%2FEM%3E%20will%20be%20used%20later%20to%20provide%20the%20proper%20level%20of%20permission%2C%20which%20in%20this%20case%20is%20Security%20Administrator.%3C%2FP%3E%0A%3COL%20start%3D%2214%22%3E%0A%3CLI%3EClose%20this%20blade%2C%20and%20under%20%3CSTRONG%3EProcess%20Automation%3C%2FSTRONG%3E%2C%20click%20%3CSTRONG%3ERunbooks%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%2215%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAdd%20Runbook%3C%2FSTRONG%3E%20button%20and%20click%20%3CSTRONG%3EQuick%20Create%3C%2FSTRONG%3E%20option.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20320px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59575iA620028109BBFD02%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig9.JPG%22%20title%3D%22Fig9.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%2216%22%3E%0A%3CLI%3EUnder%20%3CSTRONG%3EName%3C%2FSTRONG%3E%2C%20type%20the%20name%20for%20this%20runbook%2C%20under%20%3CSTRONG%3ERunbook%20type%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3EPowerShell%3C%2FSTRONG%3E%20and%20click%20%3CSTRONG%3EOK%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3CLI%3EUnder%20the%20%3CSTRONG%3EEdit%20PowerShell%20Runbook%3C%2FSTRONG%3E%20blade%2C%20type%20the%20code%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CFONT%3E%24connectionName%20%3D%20%22AzureRunAsConnection%22%3C%2FFONT%3E%3CBR%20%2F%3Etry%0A%7B%0A%20%20%20%20%23%20Get%20the%20connection%20%22AzureRunAsConnection%20%22%0A%20%20%20%20%24servicePrincipalConnection%3DGet-AutomationConnection%20-Name%20%24connectionName%20%20%20%20%20%20%20%20%20%0A%0A%20%20%20%20%22Logging%20in%20to%20Azure...%22%0A%20%20%20%20Add-AzureRmAccount%20%60%0A%20%20%20%20%20%20%20%20-ServicePrincipal%20%60%0A%20%20%20%20%20%20%20%20-TenantId%20%24servicePrincipalConnection.TenantId%20%60%0A%20%20%20%20%20%20%20%20-ApplicationId%20%24servicePrincipalConnection.ApplicationId%20%60%0A%20%20%20%20%20%20%20%20-CertificateThumbprint%20%24servicePrincipalConnection.CertificateThumbprint%20%0A%7D%0Acatch%20%7B%0A%20%20%20%20if%20(!%24servicePrincipalConnection)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%24ErrorMessage%20%3D%20%22Connection%20%24connectionName%20not%20found.%22%0A%20%20%20%20%20%20%20%20throw%20%24ErrorMessage%0A%20%20%20%20%7D%20else%7B%0A%20%20%20%20%20%20%20%20Write-Error%20-Message%20%24_.Exception%0A%20%20%20%20%20%20%20%20throw%20%24_.Exception%0A%20%20%20%20%7D%0A%7D%0A%0A%0A%23loop%20through%20all%20subscriptions%0AGet-AzureRmContext%20-ListAvailable%20-PipelineVariable%20AzureRMSub%20%7C%20Set-AzureRmContext%20%7C%20foreach%7B%20%24tier%20%3D%20get-AzureRmSecurityPricing%20%0Aif%20(%24tier.PricingTier%20-like%20'Free')%0A%7B%0A%20%20%20Set-AzureRmSecurityPricing%20-Name%20%22default%22%20-PricingTier%20%22Standard%22%0A%7D%0A%0A%20%20%20%20%20%20%20%20%7D%0A%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ENote%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E%3A%20after%20the%20Set-AzureRMSecurityPricing%20command%2C%20you%20can%20also%20add%20other%20commands%20to%20pre-configure%20some%20settings%20in%20Azure%20Security%20Center%2C%20such%20as%20the%20email%20contact.%20For%20more%20examples%2C%20read%20this%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fblog%2Fprogrammatically-onboard-and-manage-your-subscriptions-in-azure-security-center%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Eblog%20post%3C%2FA%3E%3C%2FSPAN%3E.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%2218%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%20button%2C%20and%20click%20%3CSTRONG%3EPublish%3C%2FSTRONG%3E%20button%3C%2FLI%3E%0A%3CLI%3EUnder%20%3CSTRONG%3EResources%3C%2FSTRONG%3E%20section%20click%20%3CSTRONG%3ESchedules%3C%2FSTRONG%3E%20and%20click%20%3CSTRONG%3EAdd%20a%20schedule%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20503px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59576iDC73125369F98509%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig10.JPG%22%20title%3D%22Fig10.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%2220%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3ELink%20a%20schedule%20to%20your%20runbook%3C%2FSTRONG%3E%2C%20click%20in%20the%20%3CSTRONG%3ESchedule%3C%2FSTRONG%3E%20blade%2C%20and%20click%20%3CSTRONG%3ECreate%20a%20new%20schedule%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3ENew%20Schedule%3C%2FSTRONG%3E%20blade%2C%20under%20%3CSTRONG%3EName%3C%2FSTRONG%3E%2C%20type%20the%20name%20of%20the%20schedule%2C%20click%20Recurring%20button%2C%20and%20select%20the%20frequency%20that%20you%20want%2C%20and%20click%20%3CSTRONG%3ECreate%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3ESchedule%20Runbook%3C%2FSTRONG%3E%20blade%2C%20click%20%3CSTRONG%3EOK%3C%2FSTRONG%3E%2C%20and%20close%20this%20blade.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EAt%20this%20point%20the%20Azure%20Automation%20account%20is%20created%2C%20the%20Runbook%20with%20the%20PowerShell%20script%20is%20configured%2C%20and%20the%20schedule%20is%20set.%20Now%20you%20need%20to%20grant%20Security%20Administrator%20permission%20to%20this%20account.%20Follow%20the%20steps%20below%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIn%20the%20Azure%20Portal%2C%20click%20%3CSTRONG%3EAll%20services%3C%2FSTRONG%3E%2C%20and%20type%20%3CSTRONG%3EManagement%20Groups%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EClick%20in%20the%20management%20group%20that%20will%20have%20the%20future%20subscriptions.%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3Edetails%3C%2FSTRONG%3E%20hyperlink%20besides%20the%20management%20group%20name.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20490px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59577i96387F994FE1EF4A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Fig11.JPG%22%20title%3D%22Fig11.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAccess%20Control%20(IAM)%3C%2FSTRONG%3E%20option%20and%20click%20%3CSTRONG%3EAdd%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3EAdd%20Permission%3C%2FSTRONG%3E%20blade%2C%20under%20%3CSTRONG%3ERole%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3ESecurity%20Admin%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EUnder%20select%2C%20type%20the%20name%20of%20the%20Azure%20automation%20account%2C%20and%20as%20you%20type%2C%20the%20account%20should%20appear.%20Click%20on%20it%20and%20notice%20that%20the%20account%20was%20added%20to%20the%20Selected%20members%20field.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20288px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59578iB7C9C981071FCCC9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22serviceprincipal.jpg%22%20title%3D%22serviceprincipal.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%227%22%3E%0A%3CLI%3EClick%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%20button.%3C%2FLI%3E%0A%3CLI%3EConfirm%20that%20the%20account%20appears%20as%20Security%20Admin%20rights%20as%20show%20the%20example%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20913px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F59579iA5FD6760897D3C58%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22secadmin.jpg%22%20title%3D%22secadmin.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAuthors%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EYuri%20Diogenes%2C%20Senior%20Program%20Manager%20(CxE%20Security)%3C%2FP%3E%0A%3CP%3EJohn%20Knightly%2C%20Senior%20PFE%20(Cybersecurity)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-285621%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESecurity%20Center%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
John Knightly
Microsoft

 

This article describes the steps for a scenario where Azure Security Center Standard tier needs to be automatically enabled for all new subscriptions. To enable this scenario the following components will be used:

  • Azure Management Groups
  • Azure Automation Account
  • Azure Security Center PowerShell modules

In this scenario, all new subscriptions that are created under the Enterprise Management Group will automatically have Azure Security Center standard tier enabled:

 Fig0.JPG

The Azure automation account will be running every hour (it could be less according to your business needs) and if identifies a new subscription that has Security Center Free tier, it will upgrade to Standard.

 

Implementation steps

  1. In Azure Portal, click Automation Accounts.
  2. Click Add and the Add Automation Account blade appears

 Fig1.JPG

  1. Type the name of the Automation Account, select the subscription, the Resource Group and the Location. Make sure the option Yes is selected under Create Azure Run As account and click Create button.
  2. The new automation account will appear in the list, click on it to edit.
  3. Under Shared Resources section, click Modules and click Update Azure modules button.

 Fig2.JPG

 

  1. You may receive a warning like the one below, click Yes to proceed.

 Fig3.JPG

 

  1. Wait until you see the description that the modules were updated, as shown below:

 Fig4.JPG

  1. Open a new tab in your browser and navigate the following URL:

https://www.powershellgallery.com/packages/AzureRM.Security/0.2.0-preview

  1. Click Azure Automation tab and click Deploy to Azure Automation button.

 Fig5.JPG

  1. On the new blade that opens, under Automation Account option, select the Azure Automation Account that you are creating in this article:

 Fig6.JPG

  1. Click OK button, and once the OK button becomes gray out, close the blade.
  2. Go back to the previous tab, where you have the automation account properties, and click Connections under Shared Resources section, and select AzureRunAsConnection:

 Fig7.JPG

  1. Copy the ApplicationID to the clipboard.

Note: this ApplicationID will be used later to provide the proper level of permission, which in this case is Security Administrator.

  1. Close this blade, and under Process Automation, click Runbooks.

 

  1. Click Add Runbook button and click Quick Create option.

 Fig9.JPG

  1. Under Name, type the name for this runbook, under Runbook type, select PowerShell and click OK button.
  2. Under the Edit PowerShell Runbook blade, type the code below:

 

$connectionName = "AzureRunAsConnection"
try { # Get the connection "AzureRunAsConnection " $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName "Logging in to Azure..." Add-AzureRmAccount ` -ServicePrincipal ` -TenantId $servicePrincipalConnection.TenantId ` -ApplicationId $servicePrincipalConnection.ApplicationId ` -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint } catch { if (!$servicePrincipalConnection) { $ErrorMessage = "Connection $connectionName not found." throw $ErrorMessage } else{ Write-Error -Message $_.Exception throw $_.Exception } } #loop through all subscriptions Get-AzureRmContext -ListAvailable -PipelineVariable AzureRMSub | Set-AzureRmContext | foreach{ $tier = get-AzureRmSecurityPricing if ($tier.PricingTier -like 'Free') { Set-AzureRmSecurityPricing -Name "default" -PricingTier "Standard" } }

 

Note: after the Set-AzureRMSecurityPricing command, you can also add other commands to pre-configure some settings in Azure Security Center, such as the email contact. For more examples, read this blog post.

 

  1. Click Save button, and click Publish button
  2. Under Resources section click Schedules and click Add a schedule.

 Fig10.JPG

  1. Click Link a schedule to your runbook, click in the Schedule blade, and click Create a new schedule.
  2. In the New Schedule blade, under Name, type the name of the schedule, click Recurring button, and select the frequency that you want, and click Create button.
  3. In the Schedule Runbook blade, click OK, and close this blade.

At this point the Azure Automation account is created, the Runbook with the PowerShell script is configured, and the schedule is set. Now you need to grant Security Administrator permission to this account. Follow the steps below:

  1. In the Azure Portal, click All services, and type Management Groups.
  2. Click in the management group that will have the future subscriptions.
  3. Click details hyperlink besides the management group name.

 Fig11.JPG

 

  1. Click Access Control (IAM) option and click Add button.
  2. In the Add Permission blade, under Role, select Security Admin.
  3. Under select, type the name of the Azure automation account, and as you type, the account should appear. Click on it and notice that the account was added to the Selected members field.

 serviceprincipal.jpg

  1. Click Save button.
  2. Confirm that the account appears as Security Admin rights as show the example below:

 secadmin.jpg

 

Authors

Yuri Diogenes, Senior Program Manager (CxE Security)

John Knightly, Senior PFE (Cybersecurity)