jeffbow / azurepowershell Goto Github PK
View Code? Open in Web Editor NEWCollection of various Azure ARM PowerShell scripts for managing v2 IaaS resources. Not to be confused with https://github.com/Azure/azure-powershell
License: MIT License
Collection of various Azure ARM PowerShell scripts for managing v2 IaaS resources. Not to be confused with https://github.com/Azure/azure-powershell
License: MIT License
Hi, do you have any plans to convert your PS cmdlets to use Az PowerShell cmdlets?
current load balancer copy only does basic FE IP config, BE address pools and inbound NAT rules. Need to complete LB Rules, LB Inbound NAT pool and Probes.
Good morning,
We have been using the Clone-AzureRMresourceGroup.ps1 script to test the cloning of resource groups (production) to resource groups (accepting/testing).
The last test occured last summer. After that test run the original resource group was modified. The original resource group consisted of three vm's with a single disk and a fourth vm with an additional disk.
After modifications the resource group consisted of three vm's with a single disk and a fourth vm with three additional managed disks. After running the Clone-AzureRMresourceGroup.ps1 script on the modified resource group we ran into some issues regarding the cloning process.
The resource group is created but the storage account(s) are not. In order to troubleshoot the problem I created a simple testing resource in Azure (We use terraform the create resources in Azure).
I have listed what the powershell script does at first an also listed the error:
The following items will be copied:
Storage Accounts:
testing1201st1
Managed Disks:
Virtual Machines:
server1
server2
server3
server4
Operating system disks:
serverosdisk1
serverosdisk2
serverosdisk3
serverosdisk4
Data disks:
Current status of VMs:
server1 status is VM deallocated
server2 status is VM deallocated
server3 status is VM deallocated
server4 status is VM deallocated
Virtual networks:
cc-test
Network Security Groups:
nsg-test-server1
nsg-test-server2
nsg-test-server3
nsg-test-server4
Load Balancers:
Public IPs:
server1publicip
server1publicip
server1publicip
VERBOSE: Retrieving storage context for each source blob
Additional storage blobs:
VERBOSE: Creating new resource group clone_acceptatie in northeurope
The new resource group clone_acceptatie was created in subscription RelyTest01
VERBOSE: Creating storage account testing1201st1c1af887f in resource group clone_acceptatie at location northeurope
New-AzureRmStorageAccount : Cannot bind parameter 'EnableEncryptionService'. Cannot convert the "Microsoft.Azure.Manage
ment.Storage.Models.Encryption" value of type "Microsoft.Azure.Management.Storage.Models.Encryption" to type "System.Nullable`1[Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet+EncryptionSupportServiceEnum]".
At C:\Scripts\Clone-AzureRMresourceGroup.ps1:584 char:64
~~~~~~~~~~~~~~
WARNING: Failed to create storage account. Storage account name testing1201st1c1af887f may already exists.
Enter a different Destination Storage Account Name: testing1201st2
VERBOSE: Creating storage account testing1201st2 in resource group clone_acceptatie at location northeurope
New-AzureRmStorageAccount : Cannot bind parameter 'EnableEncryptionService'. Cannot convert the "Microsoft.Azure.Manage
ment.Storage.Models.Encryption" value of type "Microsoft.Azure.Management.Storage.Models.Encryption" to type "System.Nullable`1[Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet+EncryptionSupportServiceEnum]".
At C:\Scripts\Clone-AzureRMresourceGroup.ps1:584 char:64
~~~~~~~~~~~~~~
WARNING: Failed to create storage account. Storage account name testing1201st2 may already exists.
Enter a different Destination Storage Account Name:
It does not matter which storage account is entered, the same error keeps propping up. Is there something which has changed in Azure in the last six months regarding storage (and possibly storage encryption)?
Regards, Marvin Woods
Claranet Benelux, The Netherlands.
When I need to create the destination storage account - it keeps failing:
New-AzureRmStorageAccount : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or
empty, and then try the command again.
$newStorageAccount = New-AzureRmStorageAccount $storageParams -e ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi, I am testing this script for an upcoming migration and get the error:
Enter credentials for the 'source' Azure Subscription...
WARNING: The provided credentials failed to authenticate or are not associcated to a valid subscription. Exiting the script
I have ensured that I have the correct credentials but to no avail - any assistance will be appreciated. Thank you.
The Copy-AzureRMresourceGroup.ps1 script gave me an error when attempting to create the storage account in the new resource group.
Looking at the source, I saw that the $EncryptionType variable wasn't used in the storage params. After updating the script to use this value the cmdlet ran without issue.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For reference I am copying a vm attached to a storage account between subscriptions. It is a single linux vm with 1 extra data disk. I have run the Update-Module AzureRM command and am using the latest version of PowerShell. Any help would be appreciated.
To make this script more complete, we're looking for assistance in adding the ability to copy these resources and add Pester testing:
• Web Apps
• SQL Servers
• Azure Automation Accounts
• Copy v1 cloud services and VMs
Clone-AzureRMresourceGroup.ps1 script doesn't support VMs with Managed Disk/s attached.
Describe the bug
Only lowercase characters and numbers are allowed in storage account name. Currently when creating temporary storage account, resource group name is used. Creation of temporary storage account fails if the resource group has _
in it.
To Reproduce
_
in it.Expected behavior
A temporary storage account with resource group name as prefix is created.
See Error:
Set-AzureRmVMOSDisk : Cannot validate argument on parameter 'ManagedDiskId'. The argument is null or empty. Provide an argument that is not null
or empty, and then try the command again.
At C:\Users\Calhoun.Clark\Documents\WindowsPowershell\scripts\AzurePowershell\Clone-AzureRMresourceGroup.ps1:1492 char:104
~~~~~~~~~~
"$osDisk.Id" in above code line should be "$osDiskId"
Hello @JeffBow
I have been using the Clone-AzureRMresourceGroup.ps1 script to successfully clone Resource Groups for over 6 months now.
Yesterday I updated Powershell Module AzureRM to version 6.1.1
Clone-AzureRMresourceGroup.ps1 has started failing when attempting to create a new managed Disk on the new resource group. This occurs for any attempt made.
New-AzureRmDisk : The request content was invalid and could not be
deserialized: Required property 'name' not found in 'sku'.
ErrorCode: InvalidRequestContent
ErrorMessage: The request content was invalid and could not be
deserialized: Required property 'name' not found in 'sku'.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : de9b7234-7a5f-4153-83bc-67c82374cd88
At C:\W_DRIVE\Azure Demo
Management\AzurePowerShell\Clone-AzureRMresourceGroup.ps1:760 char:27
+ ... newMDdisk = New-AzureRmDisk -ResourceGroupName $resourceGroupName
-Di ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmDisk], Compute
CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Automatio
n.NewAzureRmDisk
I was able to reinstall module AzureRM 4.4.1 and is working with no issues.
I am not sure how to diagnose further?
Hoping can help - as I would like to use the latest version of AzureRM if possible.
I have an account which has access to 5 different Subscriptions across two AAD tenants. Line 286 is #$sub = Get-AzureRmSubscription -TenantID $login.context.Subscription.TenantID which passes a given Tenant ID for the source account. In my case, since I only had 1 Subscription in the AAD Tenant, I was never prompted for the Select-AzureRmSubscription dialogue. I removed the -TenantID flag which looks like this now: $sub = Get-AzureRmSubscription and it works fine.
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Reference Azure/azure-powershell#5956
This will only effect managed disks.
I am new to Azure and we need to clone our production resource group to a testing resource group and I found this script you have for just that. But I have idea how to run it at Azure Cloud.
VERBOSE: Retrieving storage context for each source blob
You cannot call a method on a null-valued expression.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:121 char:5
$split = $srcURI.Split('/')
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cannot index into a null array.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:122 char:5
$strgDNS = $split[2]
~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:123 char:5
$splitDNS = $strgDNS.Split('.')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cannot index into a null array.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:124 char:5
$storageAccountName = $splitDNS[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get-AzureRmStorageAccountKey : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an
argument that is not null or empty, and then try the command again.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:130 char:107
~~~~~~~~~~~~~~~~~~~
New-AzureStorageContext : Cannot validate argument on parameter 'StorageAccountName'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:131 char:67
~~~~~~~~~~~~~~~~~~~
Get-AzureRmStorageAccount : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an
argument that is not null or empty, and then try the command again.
At C:\scripts\Copy-AzureRMresourceGroup.ps1:135 char:93
~~~~~~~~~~~~~~~~~~~
Additional storage blobs:
Wondered if you had done any app service cloning or Application Insights cloning?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.