This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"sqlVirtualMachineLocation": { | |
"type": "string" | |
}, | |
"sqlVirtualMachineName": { | |
"type": "string" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "Microsoft.SqlVirtualMachine/SqlVirtualMachines", | |
"apiVersion": "2017-03-01-preview", | |
"name": "[parameters('virtualMachineName')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]" | |
], | |
"properties": { | |
"virtualMachineResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This function will enable you to send mail with SendGrid without using 'Send-MailMessage' | |
.DESCRIPTION | |
Azure VM's sending mail with 'Send-MailMessage' cmdlet reported failure. Hence new script is created to handle this. | |
This script works by calling send grid v3 rest API | |
.EXAMPLE | |
PS . <pathToThisFunctionps> | |
Then you can invoke this script natively in any other scripts | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "/providers/Microsoft.Authorization/policyDefinitions/addcreatedtag", | |
"type": "Microsoft.Authorization/policyDefinitions", | |
"name": "addcreatedtag", | |
"properties": { | |
"displayName": "Append datetime (utc) tag when resource is created", | |
"policyType": "Custom", | |
"mode": "All", | |
"description": "Appends the a creationd date tag and the time (utc) when the resource was created. Does not modify the tags of resource groups created before this policy was applied until those resource groups are changed.", | |
"metadata": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Module AzTable | |
$auditfilterStorageAcc = '<yourStorageAccount>' | |
$auditfilterStorageAccRg = '<yourStorageAccoutResourceGroup' | |
$tableName = '<tableStorageName>' | |
function getStorageAcconts{ | |
$context = (Get-AzStorageAccount -Name $auditfilterStorageAcc -ResoruceGroupName $auditfilterStorageAccRg).context | |
$table = (Get-AzStorageTable -name $tableName -context $context).CloudTable | |
$result = Get-AzTableRow -Table $table -ParitionKey 'filterStorage' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Install Module - ensure you are running powershell as Administrato | |
Install-Module -Name BaselineManagement | |
## Import installed module to powershell | |
Import-Module BaselineManagement | |
## Export GPO to DSC | |
ConvertFrom-GPO -Path .\2012R2\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################################### | |
# Powershell Script to unlock Backup Vault Restore point collections.# | |
###################################################################### | |
$resources = Get-AzureRmResource | |
$resourceTypeToUnlock = 'Microsoft.Compute/restorePointCollections' | |
foreach ($resource in $resources) | |
{ | |
if($resource.ResourceType -eq $resourceTypeToUnlock){ | |
$lock = Get-AzureRmResourceLock -ResourceName $resource.Name -ResourceType $resourceTypeToUnlock -ResourceGroupName $resource.ResourceGroupName | |
if($null -ne $lock){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Powershell script referenced from http://keepingitgeek.blogspot.com/2015/01/grant-sql-server-account-access-to-lock.html | |
## Powershell script was converted to a DSC module for implementation. | |
Configuration createServiceUserUser { | |
param( | |
# Parameter help description | |
[Parameter(Mandatory)] | |
[string] | |
$VMHostName, | |
# Parameter help description | |
[Parameter(Mandatory)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-AzureRmResourceGroupDeployment -ResourceGroupName 'winVMTest'|Select-Object -Skip 100 | Remove-AzureRmResourceGroupDeployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Provide Local user credentials - No Guest user | |
# This user should be having permission to set/remove permissions on subscriptions | |
Login-AzureRmAccount -Credential (Get-Credential) | |
# Get all subscriptions and loop | |
foreach ($sub in (Get-AzureRmSubscription)){ | |
# Follow this link to view application ID | |
# https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#get-application-id-and-authentication-key | |
$application = Get-AzureRmADServicePrincipal -ApplicationId (Read-Host -Prompt 'Enter Azure Application ID') | |
$scope = [string]::Concat('/subscriptions/', $sub.ID) | |
try { |