Skip to content

Instantly share code, notes, and snippets.

{
"if": {
"field": "tags",
"exists": "false"
},
"then": {
"effect": "append",
"details": [
{
"field": "tags",
@averkinderen
averkinderen / AllowedRegion.json
Created May 15, 2017 00:31
Allowed Region Policy
{
"$schema": "http://schema.management.azure.com/schemas/2015-10-01-preview/policyDefinition.json",
"if": {
"not": {
"field": "location",
"in" : ["australiaeast" , "australiasoutheast"]
}
},
"then": {
"effect": "deny"
#variables
$ResourgeGroupName = Read-Host "Please provide name of ResourgeGroup that will be used for saving the NSG logs"
$StorageAccountLogs = Read-Host "Please provide name of Storage Account that will be used for saving the NSG logs"
#Login to the Azure Resource Management Account
Login-AzureRmAccount
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Insights
#region Get Azure Subscriptions
@averkinderen
averkinderen / PolicyDeployment.ps1
Last active August 10, 2017 18:30
Azure Resource Policy deployment
$policyName = Read-Host "Specify the name of the policy";
$policyDescription = Read-Host "Specify the description of the policy"
$policyFile = Read-Host "Path to json policy file";
#Login to the Azure Resource Management Account
Login-AzureRmAccount
#region Get Azure Subscriptions
$subscriptions = Get-AzureRmSubscription
$menu = @{}
@averkinderen
averkinderen / CreateAzureImage.ps1
Created September 4, 2017 23:39
Capture Azure VM and create Image
#################################################
# Author: Alexandre Verkinderen
# Company: cubesys
# date: 04/09/2017
################################################
Login-AzureRmAccount
#region variables
@averkinderen
averkinderen / CapacityVmss.ps1
Created September 5, 2017 03:03
Increase number of instances in a Azure scaleset
#################################################
# Author: Alexandre Verkinderen
# Company: cubesys
# date: 05/09/2017
################################################
#Login-AzureRmAccount
#region variables
@averkinderen
averkinderen / CPUstress.ps1
Created September 5, 2017 03:04
This script will saturate a specified number of CPU cores to 100% utilization. The parameter 'NumHyperCores' is required and you need to specify, at minimum, the total number of cores on the computer/server you wish to test. If hyper-threading is enabled you need to ensure that you select the proper number or total saturation will not occur. Sel…
<#
.SYNOPSIS
This script will saturate a specified number of CPU cores to 100% utilization.
.DESCRIPTION
This script will saturate a specified number of CPU cores to 100% utilization.
@averkinderen
averkinderen / limitedadmin.json
Last active September 11, 2017 00:08
Create a custom Azure Limited Admin custom role
{
"Name": "Limited Admin",
"Id": null,
"IsCustom": true,
"Description": "Can do anything except changing permissions and network settings.",
"Actions": [
"*"
],
"NotActions": [
"Microsoft.Network/virtualNetworks/write",
@averkinderen
averkinderen / NoClassic.json
Created November 21, 2017 05:39
Deny any classic resources
{
"if": {
"field": "type",
"like": "Microsoft.Classic*"
},
"then": {
"effect": "Deny"
}
}
@averkinderen
averkinderen / NamingConvention.json
Created December 6, 2017 23:51
Allow multiple name patterns
{
"properties": {
"displayName": "Match multiple name patterns.",
"description": "Allows one of multiple naming patterns for resources.",
"mode": "all",
"policyRule": {
"if": {
"allOf": [
{
"not": {