Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48333a5
Update readme.md
brootware Sep 4, 2018
c3e2357
Create addMarketPlaceTermstoVM
brootware Sep 25, 2018
23214bf
Create moveDisktoAZ.ps1
brootware Sep 25, 2018
af50579
Update and rename copyMDNoDowntime to copyMDNoDowntime.ps1
brootware Sep 25, 2018
560c074
Create cloneNSGsAcrossSub.ps1
brootware Sep 25, 2018
fee7086
Create marketPlaceWithAvailabilityZones
brootware Nov 10, 2018
639800e
Update copyMDNoDowntime.ps1
brootware Nov 28, 2018
67491d3
Update copyMDNoDowntime.ps1
brootware Dec 7, 2018
c53d80a
refactor
brootware Jan 9, 2019
913eba2
Update cloneNSGsAcrossSub.ps1
brootware Jan 9, 2019
105f716
Update marketPlaceWithAvailabilityZones
brootware Feb 13, 2019
e62ca55
Update marketPlaceWithAvailabilityZones
brootware Feb 13, 2019
6247865
Update marketPlaceWithAvailabilityZones
brootware Feb 13, 2019
5261008
Create checkMarketPlaceImage
brootware Feb 26, 2019
74135d8
Update checkMarketPlaceImage
brootware Feb 26, 2019
d4da3d7
Create createBlobSAS.ps1
brootware Mar 20, 2019
ebfcac0
Update InstallUpdateAzureRM&AD.ps1
brootware May 23, 2019
7232966
Directory Changes
Jul 26, 2019
0a3bf1e
azure install updates
Jul 26, 2019
66c8d61
Another Directory change
Jul 26, 2019
f11989a
minor script changes
Jul 26, 2019
a5a5f73
updated readme
Jul 26, 2019
2db9e3d
update readmes
Jul 26, 2019
d004536
readme update
Jul 26, 2019
07a5914
readme update
Jul 26, 2019
7c226d6
az readme update
Jul 26, 2019
440a4f8
refactor statusloopcopy managed disk
Jul 29, 2019
9fddef8
not much changes
Jul 31, 2019
f43207a
Update copyMDNoDowntime.ps1
brootware Oct 11, 2019
5010427
Update marketplaceCheckNDeploy.ps1
brootware Sep 4, 2020
1deba8a
Update marketplaceCheckNDeploy.ps1
brootware Sep 4, 2020
cd11c7f
Create registerMove.ps1
brootware Jan 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions Azure/Azure-Automation/Scheduling-VMs/Turn off and on.ps1

This file was deleted.

1 change: 0 additions & 1 deletion Azure/Azure-Automation/Scheduling-VMs/readme.md

This file was deleted.

35 changes: 0 additions & 35 deletions Azure/Basics/InstallUpdateAzureRM&AD.ps1

This file was deleted.

1 change: 0 additions & 1 deletion Azure/Basics/readme.md

This file was deleted.

22 changes: 0 additions & 22 deletions Azure/StatusLoopCopyManagedDisktoStorageAccount.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions Azure/copyMDNoDowntime

This file was deleted.

1 change: 0 additions & 1 deletion Azure/readme.md

This file was deleted.

17 changes: 17 additions & 0 deletions AzureAzTemplates/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## To Install the new Az module based on .Net Core.
Currently in progress of converting existing RM scripts into Az. Contributions welcome! Only install this module after uninstalling the RM modules.
To Uninstall all AzureRM module
```
$versions = (Get-InstalledModule AzureRM -AllVersions | Select-Object Version)
$versions | foreach { Uninstall-AllModules -TargetModule AzureRM -Version ($_.Version) -Force }
Get-Module -ListAvailable | Where-Object { $_.Name -like 'AzureRM*' } | Uninstall-Module
```
To Uninstall all Azure

```Get-Module -ListAvailable | Where-Object { $_.Name -like 'Azure*' } | Uninstall-Module```

## To Install and Update the module
```
Install-Module -Name Az
Install-Module -Name Az -AllowClobber -Force
```
16 changes: 16 additions & 0 deletions AzureAzTemplates/registerMove.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
##############################################################
########## Register Backup and Managed Disk ##################
##############################################################
Register-AzProviderFeature -ProviderNamespace Microsoft.RecoveryServices -FeatureName RecoveryServicesResourceMove
Register-AzResourceProvider -ProviderNamespace Microsoft.RecoveryServices
Register-AzProviderFeature -FeatureName ManagedResourcesMove -ProviderNamespace Microsoft.Compute
Register-AzResourceProvider -ProviderNamespace Microsoft.Compute
do {
$getMdStatus = Get-AzProviderFeature -FeatureName ManagedResourcesMove -ProviderNamespace Microsoft.Compute
$getvaultStatus = Get-AzProviderFeature -FeatureName RecoveryServicesResourceMove -ProviderNamespace Microsoft.RecoveryServices
$getMdStatus
$getVaultStatus
Start-Sleep -Seconds 20
}
while ($getMdStatus.RegistrationState.Equals("Registering") -and $getVaultStatus.RegistrationState.Equals("Registering"))
Write-Host "Registration Completed."
35 changes: 35 additions & 0 deletions AzureRmTemplates/StatusLoopCopyManagedDisktoStorageAccount.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#This command sets the execution policy to bypass for only the current PowerShell session.
#After the window is closed, the next PowerShell session will open running with the default execution policy.
#“Bypass” means nothing is blocked and no warnings, prompts, or messages will be displayed.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

##Define variables
$sourceRG = "sourceRgName"
$sourceDisk = "sourceDiskName"
$targetStorageAccount = "targetStorageAccountName"
$targetStorageAccountKey = "targetStorageAccountKey"
$targetStorageAccountContainer = "targetStorageAccountContainerName"
$targetDisk = "targetDiskName.vhd"

##Login
Login-AzureRmAccount

$sas = Grant-AzureRmDiskAccess -ResourceGroupName $sourceRG -DiskName $sourceDisk -DurationInSecond 3600 -Access Read

$destContext = New-AzureStorageContext –StorageAccountName $targetStorageAccount -StorageAccountKey $targetStorageAccountKey

$blob1 = Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer $targetStorageAccountContainer -DestContext $destContext -DestBlob $targetDisk

### Retrieve the current status of the copy operation ###
$status = $blob1 | Get-AzureStorageBlobCopyState 

### Print out status ### 
$status 

### Loop until complete ###                                    
While($status.Status -eq "Pending"){
  $status = $blob1 | Get-AzureStorageBlobCopyState 
  Start-Sleep 10
  ### Print out status ###
  $status
}
File renamed without changes.
28 changes: 28 additions & 0 deletions AzureRmTemplates/checkMarketPlaceImage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
##From 4sysop

$locname=Get-AzureRmLocation | `
select displayname | `
Out-GridView -PassThru -Title "Choose a location"

$pubname=Get-AzureRmVMImagePublisher `
-Location $locname.DisplayName | `
Out-GridView -PassThru -Title "Choose a publisher"

$offername = Get-AzureRmVMImageOffer `
-Location $locname.DisplayName `
-PublisherName $pubname.PublisherName | `
Out-GridView -PassThru -Title "Choose an offer"

$title="SKUs for location: " + `
$locname.DisplayName + `
", Publisher: " + `
$pubname.PublisherName + `
", Offer: " + `
$offername.Offer

Get-AzureRmVMImageSku `
-Location $locname.DisplayName `
-PublisherName $pubname.PublisherName `
-Offer $offername.Offer | `
select SKUS | `
Out-GridView -Title $title
34 changes: 34 additions & 0 deletions AzureRmTemplates/cloneNSGsAcrossSub.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#This script is adapted from https://gallery.technet.microsoft.com/scriptcenter/Azure-Clone-an-Network-84ea5fa3
#Repurposed to clone the NSGs with multiple rules across subscription within the same AAD

$sourceSubscriptionId = "sourceSubId"
$sourceTenantId = "sourceTenantId"
$nsgOrigin = "sourceNSG"
$rgName = "sourceRG" #Resource Group Name of source NSG

$targetSubscriptionId="targetSubId"
$targetTenantId = "targetTenantId"
$nsgDestination = "targetNSG" #name new NSG. Must create in target subscription first
$rgNameDest = "targetRG" #Resource Group Name when you want the new NSG placed

#select source subscription and get rules
Set-AzureRmContext -SubscriptionId $sourceSubscriptionId -TenantId $sourceTenantId
$nsg = Get-AzureRmNetworkSecurityGroup -Name $nsgOrigin -ResourceGroupName $rgName
$nsgRules = Get-AzureRmNetworkSecurityRuleConfig -NetworkSecurityGroup $nsg

Set-AzureRmContext -SubscriptionId $targetSubscriptionId -TenantId $targetTenantId

$newNsg = Get-AzureRmNetworkSecurityGroup -name $nsgDestination -ResourceGroupName $rgNameDest
foreach ($nsgRule in $nsgRules) {
Add-AzureRmNetworkSecurityRuleConfig -NetworkSecurityGroup $newNsg `
-Name $nsgRule.Name `
-Protocol $nsgRule.Protocol `
-SourcePortRange $nsgRule.SourcePortRange `
-DestinationPortRange $nsgRule.DestinationPortRange `
-SourceAddressPrefix $nsgRule.SourceAddressPrefix `
-DestinationAddressPrefix $nsgRule.DestinationAddressPrefix `
-Priority $nsgRule.Priority `
-Direction $nsgRule.Direction `
-Access $nsgRule.Access
}
Set-AzureRmNetworkSecurityGroup -NetworkSecurityGroup $newNsg
19 changes: 19 additions & 0 deletions AzureRmTemplates/copyMDNoDowntime.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# The following script lets you copy a managed disk across 2 subscriptions in the same tenant instantaneously.
### SOURCE DETAILS
$SourceSubId = 'SourceID'
$SourceRGName = 'SourceRG'
$SourceDiskName = 'SourceOSDISK'

### TARGET DETAILS
$TargetSubId = 'SubID'
$TargetTenantId = 'TenantID'
$TargetRGName = 'TargetRG'

### Select Source Context
Select-AzureRmContext -SubscriptionId $TargetSubId -TenantId $TargetTenantId
$managedDisk= Get-AzureRMDisk -ResourceGroupName $SourceRGName -DiskName $SourceDiskName

### Select Target Context
Select-AzureRmSubscription -SubscriptionId $TargetSubId
$diskConfig = New-AzureRmDiskConfig -SourceResourceId $managedDisk.Id -Location $managedDisk.Location -CreateOption Copy
New-AzureRmDisk -Disk $diskConfig -DiskName $SourceDiskName -ResourceGroupName $TargetRGName
25 changes: 25 additions & 0 deletions AzureRmTemplates/createBlobSAS.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#This script allows you to create an SAS policy on your existing storage account and lets you grab SAS key.
#Useful for this tutorial https://docs.microsoft.com/en-us/sql/relational-databases/tutorial-use-azure-blob-storage-service-with-sql-server-2016?view=sql-server-2017
#SQL Server backing up to Azure Blob Storage

#Defining Variables
$storageAccountName = "<SA Name>"
$resourceGroupName = "<RG Name>"
$containerName = "<containerName>"
$policyName = "<name>" + "policy"

# Get the access keys for the Azure Resource Manager storage account
$accountKeys = Get-AzStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName

# Create a new storage account context using an Azure Resource Manager storage account
$storageContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $accountKeys[0].Value

# Creates a new container in blob storage
$container = Get-AzureStorageContainer -Context $storageContext -Name $containerName

# Sets up a Stored Access Policy and a Shared Access Signature for the new container
$policy = New-AzureStorageContainerStoredAccessPolicy -Container $containerName -Policy $policyName -Context $storageContext -StartTime $(Get-Date).ToUniversalTime().AddMinutes(-5) -ExpiryTime $(Get-Date).ToUniversalTime().AddYears(10) -Permission rwld

# Gets the Shared Access Signature for the policy
$sas = New-AzureStorageContainerSASToken -name $containerName -Policy $policyName -Context $storageContext
Write-Host 'Shared Access Signature= '$($sas.Substring(1))''
Loading