update
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
#
|
||||
# Module manifest for module 'PSGet_ITDAzureRM'
|
||||
#
|
||||
# Generated by: zmeier
|
||||
#
|
||||
# Generated on: 2/18/2019
|
||||
#
|
||||
|
||||
@{
|
||||
|
||||
# Script module or binary module file associated with this manifest.
|
||||
RootModule = 'ITDAzureRM.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '0.4.0'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = 'dec17c9a-f0ec-439f-ac81-bc24a4815115'
|
||||
|
||||
# Author of this module
|
||||
Author = 'zmeier','cdfelchle'
|
||||
|
||||
# Company or vendor of this module
|
||||
CompanyName = 'Unknown'
|
||||
|
||||
# Copyright statement for this module
|
||||
Copyright = '(c) 2019 zmeier. All rights reserved.'
|
||||
|
||||
# Description of the functionality provided by this module
|
||||
Description = 'Functions for Azure Resource Manager administrative tasks'
|
||||
|
||||
# Minimum version of the Windows PowerShell engine required by this module
|
||||
# PowerShellVersion = ''
|
||||
|
||||
# Name of the Windows PowerShell host required by this module
|
||||
# PowerShellHostName = ''
|
||||
|
||||
# Minimum version of the Windows PowerShell host required by this module
|
||||
# PowerShellHostVersion = ''
|
||||
|
||||
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
|
||||
# DotNetFrameworkVersion = ''
|
||||
|
||||
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
|
||||
# CLRVersion = ''
|
||||
|
||||
# Processor architecture (None, X86, Amd64) required by this module
|
||||
# ProcessorArchitecture = ''
|
||||
|
||||
# Modules that must be imported into the global environment prior to importing this module
|
||||
# RequiredModules = @()
|
||||
|
||||
# Assemblies that must be loaded prior to importing this module
|
||||
# RequiredAssemblies = @()
|
||||
|
||||
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||
# ScriptsToProcess = @()
|
||||
|
||||
# Type files (.ps1xml) to be loaded when importing this module
|
||||
# TypesToProcess = @()
|
||||
|
||||
# Format files (.ps1xml) to be loaded when importing this module
|
||||
# FormatsToProcess = @()
|
||||
|
||||
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
|
||||
# NestedModules = @()
|
||||
|
||||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||
FunctionsToExport = 'Set-ITDAzureRMResourceGroupAssignment', 'Get-ITDAzureRMIPs',
|
||||
'Set-ITDAzureRMResourceGroupTags',
|
||||
'Set-ITDAzureRMResourceGroupTagsRefresh',
|
||||
'New-ITDAzureRMPolicyDefinition',
|
||||
'Find-ITDAzureRMUntaggedResources', 'New-ITDAzureRMVM',
|
||||
'Remove-ITDAzureRMResourceGroupTags', 'Add-ITDAzureRMNewDataDisk',
|
||||
'New-ITDAzureVM', 'New-ITDAzureRMResourceGroup', 'Find-ITDAzureRMVM',
|
||||
'Set-ITDAzureRmVMBackup'
|
||||
|
||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||
CmdletsToExport = '*'
|
||||
|
||||
# Variables to export from this module
|
||||
VariablesToExport = '*'
|
||||
|
||||
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
|
||||
AliasesToExport = '*'
|
||||
|
||||
# DSC resources to export from this module
|
||||
# DscResourcesToExport = @()
|
||||
|
||||
# List of all modules packaged with this module
|
||||
# ModuleList = @()
|
||||
|
||||
# List of all files packaged with this module
|
||||
# FileList = @()
|
||||
|
||||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
|
||||
PrivateData = @{
|
||||
|
||||
PSData = @{
|
||||
|
||||
# Tags applied to this module. These help with module discovery in online galleries.
|
||||
# Tags = @()
|
||||
|
||||
# A URL to the license for this module.
|
||||
# LicenseUri = ''
|
||||
|
||||
# A URL to the main website for this project.
|
||||
# ProjectUri = ''
|
||||
|
||||
# A URL to an icon representing this module.
|
||||
# IconUri = ''
|
||||
|
||||
# ReleaseNotes of this module
|
||||
# ReleaseNotes = ''
|
||||
|
||||
# Prerelease string of this module
|
||||
# Prerelease = ''
|
||||
|
||||
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
|
||||
# RequireLicenseAcceptance = False
|
||||
|
||||
# External dependent modules of this module
|
||||
# ExternalModuleDependencies = ''
|
||||
|
||||
} # End of PSData hashtable
|
||||
|
||||
} # End of PrivateData hashtable
|
||||
|
||||
# HelpInfo URI of this module
|
||||
# HelpInfoURI = ''
|
||||
|
||||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
|
||||
# DefaultCommandPrefix = ''
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
||||
#20190204 - 2nd comment, this one in master branch
|
||||
#7th comment
|
||||
|
||||
# copy disk example
|
||||
<#
|
||||
set-azurermcontext -Subscription npd01
|
||||
$disk = Get-AzureRmDisk -ResourceGroupName rg-doh-intranetconnections-tst -DiskName vm-itddohict1-app-tst-001
|
||||
set-azurermcontext -Subscription prd01
|
||||
$newdisk = New-AzureRmDiskConfig -SourceResourceId $disk.Id -Location centralus -CreateOption Copy
|
||||
New-AzureRmDisk -ResourceGroupName rg-doh-intranetconnections-prd -DiskName vm-itddohicp1-app-prd-001 -Disk $newdisk
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
$computername="itdadfsldt1"
|
||||
#Provide the subscription Id
|
||||
$subscriptionId = '76297098-764c-43de-8525-c9fda1b237be'
|
||||
|
||||
#Provide the name of your resource group
|
||||
$resourceGroupName ='rg-infra-adfs-tst'
|
||||
|
||||
Set-AzureRmContext -Subscription infra01
|
||||
$disk = Get-AzureRmDisk -ResourceGroupName $resourceGroupName -DiskName "dev_sda-vm_itdadfsldt1_tst"
|
||||
Set-AzureRmContext -Subscription npd01
|
||||
$newdisk = New-AzureRmDiskConfig -SourceResourceId $disk.Id -Location centralus -CreateOption Copy
|
||||
New-AzureRmDisk -ResourceGroupName $resourceGroupName -DiskName vm-$computername-os-tst -Disk $newdisk
|
||||
|
||||
#Provide the name of the OS disk that will be created using the snapshot
|
||||
$osDiskName = "vm-$computername-os-tst"
|
||||
|
||||
#Provide the name of the virtual machine
|
||||
$virtualMachineName = "vm-$computername-tst"
|
||||
|
||||
$nicName = "nic-$computername-tst-101"
|
||||
|
||||
#Provide the size of the virtual machine
|
||||
#e.g. Standard_DS3
|
||||
#Get all the vm sizes in a region using below script:
|
||||
#e.g. Get-AzureRmVMSize -Location westus
|
||||
$virtualMachineSize = 'Standard_A1'
|
||||
|
||||
#Set the context to the subscription Id where Managed Disk will be created
|
||||
#Select-AzureRmSubscription -SubscriptionId $SubscriptionId
|
||||
Set-AzureRmContext -Subscription npd01
|
||||
<#
|
||||
$resourceGroupName="rg-doh-intranetconnections-prd"
|
||||
$osDiskName="vm-itddohicp1-os-prd"
|
||||
$virtualMachineName="vm-itddohicp1-prd"
|
||||
$virtualMachineSize="Standard_B2ms"
|
||||
$nicName="nic-itddohicp1-prd"
|
||||
#>
|
||||
|
||||
$disk = Get-AzureRmDisk -ResourceGroupName $resourceGroupName -DiskName $osDiskName
|
||||
|
||||
#Initialize virtual machine configuration
|
||||
$VirtualMachine = New-AzureRmVMConfig -VMName $virtualMachineName -VMSize $virtualMachineSize
|
||||
|
||||
#Use the Managed Disk Resource Id to attach it to the virtual machine. Please change the OS type to linux if OS disk has linux OS
|
||||
$VirtualMachine = Set-AzureRmVMOSDisk -VM $VirtualMachine -ManagedDiskId $disk.Id -CreateOption Attach -Linux
|
||||
|
||||
$nic = Get-AzureRmNetworkInterface -ResourceGroupName $resourcegroupname -Name $nicName
|
||||
|
||||
$VirtualMachine = Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id $nic.Id
|
||||
|
||||
#Create the virtual machine with Managed Disk
|
||||
New-AzureRmVM -VM $VirtualMachine -ResourceGroupName $resourceGroupName -Location centralus
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Set-AzureRmContext -Subscription infra01
|
||||
$disks = Get-AzureRmDisk -ResourceGroupName rg-infra-adfs-tst -ov npddisks
|
||||
Set-AzureRmContext -Subscription npd01
|
||||
ForEach($d in $disks)
|
||||
{
|
||||
$newdisk=$null
|
||||
$computername=$null
|
||||
|
||||
|
||||
$computername = $d.name.split('_')[2]
|
||||
If($d.name -like "*sda*")
|
||||
{
|
||||
$newname = "vm-$computername-os-tst"
|
||||
}
|
||||
If($d.name -like "*sdb*")
|
||||
{
|
||||
$newname = "vm-$computername-app-tst-101"
|
||||
$newdisk = New-AzureRmDiskConfig -SourceResourceId $d.Id -Location centralus -createoption Copy
|
||||
New-AzureRmDisk -ResourceGroupName rg-infra-adfs-tst -DiskName $NewName -Disk $newdisk
|
||||
}
|
||||
}
|
||||
<#
|
||||
$disk = Get-AzureRmDisk -ResourceGroupName rg-infra-adfs-tst -DiskName dev_sdb-vm_itdadfsintldt1_tst
|
||||
set-azurermcontext -Subscription npd01
|
||||
$newdisk = New-AzureRmDiskConfig -SourceResourceId $disk.Id -Location centralus -CreateOption Copy
|
||||
New-AzureRmDisk -ResourceGroupName rg-infra-adfs-tst -DiskName vm-itdadfsldt1-app-tst-001 -Disk $newdisk
|
||||
#>
|
||||
Reference in New Issue
Block a user