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": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"newVMName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of an VM to be created" | |
} | |
}, |
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
param | |
( | |
[Parameter(Mandatory = $true)] | |
[string] $subscriptionId = $(Read-Host -prompt "Specify the subscription Id"), | |
[Parameter(Mandatory = $true)] | |
[string] $labResourceGroup = $(Read-Host -prompt "Specify the resource group for the DevTest Lab"), | |
[Parameter(Mandatory = $true)] | |
[string] $labName = $(Read-Host -prompt "Specify the name of the DevTest Lab"), |
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
$subscriptionId = "<insert your subscription id here>" | |
$policyRoleDef = (Get-AzureRmRoleDefinition "DevTest Labs User") | |
$policyRoleDef.Actions.Remove('Microsoft.DevTestLab/Environments/*') | |
$policyRoleDef.Id = $null | |
$policyRoleDef.Name = "DevTest Labs Advanced User" | |
$policyRoleDef.Description = "Lets you connect, start, restart, shutdown and resize ALL virtual machines in your Azure DevTest Labs." | |
$policyRoleDef.IsCustom = $true | |
$policyRoleDef.AssignableScopes.Clear() | |
$policyRoleDef.AssignableScopes.Add("/subscriptions/$($subscriptionId )") |
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
{ | |
"Name": "Dev Test Labs Advanced User", | |
"Id": null, | |
"IsCustom": true, | |
"Description": "Lets you connect, start, restart, shutdown and resize ALL virtual machines in your Azure DevTest Labs.", | |
"Actions": [ | |
"Microsoft.Authorization/*/read", | |
"Microsoft.Compute/availabilitySets/read", | |
"Microsoft.Compute/virtualMachines/*/read", | |
"Microsoft.Compute/virtualMachines/deallocate/action", |
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
$AadTenant = "" # <-- AAD tenant ID | |
$AadAppId = "" # <-- App Id of the identity to use | |
$AadAppKey = "" # <-- Secret key of this identity | |
$AdlsAccountName = "" # <-- name of your ASLD Gen2 account | |
$FileSystemName = "" # <-- name of the file system to create | |
$DirPath = "" # <-- Directory path to create | |
$FileName = "" # <-- File name to create on ADLS |
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
$properties = @{Name = ""; ResourceGroupName =""; Location = ""; SkuName = ""; SkuTier = ""; Subscription = ""} | |
$gwTemplate = New-Object -TypeName PSObject -Property $properties | |
$qwCollection = @() | |
$subs = Get-AzSubscription | |
foreach($sub in $subs) | |
{ | |
Select-AzSubscription -Subscription $sub.Name |
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 | |
Managed disks in Azure have no direct facilitites to access the underlying URL/path the disk resides in since | |
they are placed into storage accounts under the hood by Azure. Often times there's a desire to take a disk from a single | |
VM and move to another region where you can create a new VM and attach to the disk that's copied. This script | |
provides a means to do that and has been tested as working using the new AZ PowerShell cmdlets. | |
If this is run in a PowerShell context without the new AZ cmdlets installed; simply do a search and replace of Az to AzureRM. | |
Note: The SOURCE VM needs to be powered off to create the SAS URL and to ensure no writes are occuring to the disk during the copy. | |
.DESCRIPTION | |
This script will require you to populate the source resource group and source managed disk name as well as the destination resource group, |
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
{ | |
"properties": { | |
"displayName": "Append NSG if missing", | |
"description": "Sets default NSG if none is specified", | |
"policyType": "Custom", | |
"mode": "All", | |
"parameters": { | |
"nsgResourceId": { | |
"type": "String", | |
"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
<# | |
.SYNOPSIS | |
This script will configure EventHub logging for all Azure Activity logs in multiple subscriptions so that you can then archive the logs to another system | |
See: https://docs.microsoft.com/en-us/powershell/module/az.monitor/add-azlogprofile | |
.DESCRIPTION | |
Using an AAD account that has access to all of the subscriptions that you need to configure, this will loop through all of those | |
subscriptions, find all of the EventHub namespaces in those subscriptions and then find an EventHub that meets a specific naming format. | |
Once the proper EventHub is found, it will set the log profile for you | |
The naming format of the EventHub is up to you and can be edited on the "if($eventHub.Name ..." line #45 |
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
{ | |
"Name": "Tag Manager Role", | |
"Description": "Can only add/edit/delete resource tags", | |
"Id": null, | |
"IsCustom": true, | |
"Actions": [ | |
"*/read", | |
"Microsoft.Resources/tags/write", | |
"Microsoft.Resources/tags/delete" | |
], |
OlderNewer