Skip to content

Instantly share code, notes, and snippets.

@averkinderen
averkinderen / EnableNSGFlowV2.ps1
Last active Jul 18, 2019
Enable NSG Flow and Traffic Analytics
View EnableNSGFlowV2.ps1
<#
=======================================================================================
AUTHOR: Alexandre Verkinderen
DATE: 18/07/2019
Version: 1.0
Comment: bulk enable NSG flow and traffic analytics
=======================================================================================
#>
#variables
@averkinderen
averkinderen / NamingConvention.json
Created Dec 6, 2017
Allow multiple name patterns
View NamingConvention.json
{
"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 Nov 21, 2017
Deny any classic resources
View NoClassic.json
{
"if": {
"field": "type",
"like": "Microsoft.Classic*"
},
"then": {
"effect": "Deny"
}
}
@averkinderen
averkinderen / limitedadmin.json
Last active Sep 11, 2017
Create a custom Azure Limited Admin custom role
View limitedadmin.json
{
"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 Sep 5, 2017
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…
View CPUstress.ps1
<#
.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 Sep 5, 2017
Increase number of instances in a Azure scaleset
View CapacityVmss.ps1
#################################################
# Author: Alexandre Verkinderen
# Company: cubesys
# date: 05/09/2017
################################################
#Login-AzureRmAccount
#region variables
@averkinderen
averkinderen / CreateAzureImage.ps1
Created Sep 4, 2017
Capture Azure VM and create Image
View CreateAzureImage.ps1
#################################################
# Author: Alexandre Verkinderen
# Company: cubesys
# date: 04/09/2017
################################################
Login-AzureRmAccount
#region variables
View DisableNSGDiagnostics.ps1
#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
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…
View EnableNSGDiagnostics.ps1
#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
View AllowedRegion.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-10-01-preview/policyDefinition.json",
"if": {
"not": {
"field": "location",
"in" : ["australiaeast" , "australiasoutheast"]
}
},
"then": {
"effect": "deny"
You can’t perform that action at this time.