Skip to content

Instantly share code, notes, and snippets.

@averkinderen
averkinderen / EnableNSGFlowV2.ps1
Last active July 18, 2019 04:25
Enable NSG Flow and Traffic Analytics
<#
=======================================================================================
AUTHOR: Alexandre Verkinderen
DATE: 18/07/2019
Version: 1.0
Comment: bulk enable NSG flow and traffic analytics
=======================================================================================
#>
#variables
@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": {
@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 / 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 / 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 / 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 / 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
#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 / EnableNSGDiagnostics.ps1
Created May 18, 2017 01:24
Network Security Group flow logs are a feature of Network Watcher that allows you to view information about ingress and egress IP traffic through a Network Security Group. These flow logs are written in json format and show outbound and inbound flows on a per rule basis, the NIC the flow applies to, 5-tuple information about the flow (Source/Des…
#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"
$retentionperiod = Read-Host "Please provide retention period"
#Login to the Azure Resource Management Account
#Login-AzureRmAccount
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Insights
@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"