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
$MyService = @() | |
$EmailFrom = @() | |
$Subject = @() | |
$Body = @() | |
$computer = @() | |
$computer = gc env:computername | |
$SMTPServer = "smtp.sendgrid.net" | |
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) | |
$SMTPClient.EnableSsl = $false |
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
Add-AzureRmAccount | |
########################################################################################## | |
########################## Select Source Subscription ############################ | |
########################################################################################## | |
#region Select a source & target subscription | @marckean | |
$subscription = Get-AzureRmSubscription | Out-GridView -Title "Select the Source Azure subscription that you want to use ..." -PassThru | |
$SourceSubscriptionID = $Subscription.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
$StackAadTenantId="<>.onmicrosoft.com" | |
#region Source Environment | @marckean | |
$MigrationOptions = @("Azure Public", "Azure Stack") | |
cls | |
Write-Host "`nWhere does the VM exist?" -ForegroundColor Cyan | |
$SourceEnvironment = ($MigrationOptions | Out-GridView -Title "Where are you migrating from?" -PassThru) |
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
### Log into Azure ARM | |
Login-AzureRmAccount | |
### Choose Subscription | |
$subscription = (Get-AzureRmSubscription | Out-GridView -Title "Select the Azure subscription that you want to use ..." -PassThru).SubscriptionName | |
Select-AzureRmSubscription -SubscriptionName $subscription | |
########################################################################################## | |
########################## Select source Virtual Machine ########################### | |
########################################################################################## |
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
# Written with Azure PowerShell module v6.1.0 available from https://github.com/Azure/azure-powershell/releases/tag/v6.1.0-May2018 | |
# Recently tested fully with a later version of the Azure PowerShell module - Install-Module AzureRM -RequiredVersion 6.1.0 | |
###################### | |
############## Step 0: Change Variables, and logon | |
###################### | |
# Define Azure Automation Assets | |
$AutomationAppIDName = 'AutomationAppId' # Feel free to change to suit you | |
$AutomationTenantIDName = 'AutomationTenantId' # Feel free to change to suit you |
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
$OU = 'OU=Test Users,DC=test,DC=local' | |
$primaryemaildomain = "demo.domain.com" | |
$secondaryemaildomain = "demo2.domain.com" | |
$users = Import-Csv C:\users\Administrator\Desktop\New-ADUser.csv | |
$users | ForEach-Object { | |
$Name = $_.givenname + " " + $_.surname | |
$UPN = ($_.GivenName).ToLower().Chars(0) + $_.Surname.ToLower() + "@" + $primaryemaildomain | |
$SamAccountName = ($_.GivenName).ToLower().Chars(0) + $_.Surname.ToLower() | |
#$secondaryaddress = ($_.GivenName).ToLower().Chars(0) + $_.Surname.ToLower() + "@" + $secondaryemaildomain | |
$password = $_.AccountPassword |
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
### Written with Azure PowerShell Module version 4.4.1 | |
# Fill in the below variables | |
$SPDisplayName = 'User Account SP' | |
$SPPassword = 'password' # Password is required | |
$ResourceGroup = '' # Leave blank for subscription scope as to where to apply the SP role to | |
$Role = 'Contributor' # Could also be 'Owner' | |
Login-AzureRmAccount | |
### Choose Subscription |
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
# | |
# Encrypt and Decrypt using Rijndael 256bit - Run as administrator! | |
# | |
$DnsName = 'MyEncryptionCert' # DNS name of the certificate you want to use for encryption | |
# Only Create a new certificate if you need to | |
# To Create the certificate | |
# New-SelfSignedCertificate -Type DocumentEncryptionCertLegacyCsp -DnsName $DnsName -HashAlgorithm SHA256 |
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
### Log into Azure using certificate authentication | |
$AzureADAppID = '49fy7934-dc71-4bdd-8804-h9742fyh93y' | |
$certThumbprint = (Get-ChildItem Cert:\LocalMachine\My | where {$_.Subject -match 'PowerShell_SP'}).ThumbPrint | |
$TenantId = '3494h480-6a11-78k0-a439-49hh8f49d0' | |
Login-AzureRmAccount -ServicePrincipal -TenantId $tenantId -ApplicationId $AzureADAppId -CertificateThumbprint $certThumbprint | |
$Subscription = (Get-AzureRmSubscription | Out-GridView -Title "Choose a Source & Target Subscription ..." -PassThru) | |
Select-AzureRmSubscription -SubscriptionId $Subscription.Id |
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": { | |
"SBname": { | |
"type": "string" | |
}, | |
"location": { | |
"type": "array", | |
"defaultValue": [ |