Skip to content

Instantly share code, notes, and snippets.

@win2000b
Last active August 2, 2022 19:57
Show Gist options
  • Save win2000b/4512b162eb8beafccd9bb39eefbd597a to your computer and use it in GitHub Desktop.
Save win2000b/4512b162eb8beafccd9bb39eefbd597a to your computer and use it in GitHub Desktop.
Analyse Azure Resources Migration from Direct Billing to CSP
# First of all we are assuming we have delegated rights through CSP
# If we dont have delegated rights we need a login with reader rights in the customers subscription
# We then need 2 things. The Tenant ID of where the source subscription is located
# Then we need the subscription ID for the source subscription.
# If a customer has multiple subscriptions we will need the IDs for each and the script should be run for each.
# If you need to install Azure Module
Install-Module AzureRM
# Define these 2 variables.
$TenantID = "aaaaeaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
$SubID = "ggggggg-ffff-dddd-aaaa-uytrrrrrrrr"
# Enter your CSP Credentials
$credentials = Get-Credential
# Connect to Azure
Login-AzureRmAccount -Credential $credentials -Subscription $SubID -TenantId $TenantID
# Export List of all resources in subscription to CSV file for analysis
Get-AzureRMResource | Export-CSV c:\temp\CustomerSubscription.csv -NoClobber -NoTypeInformation
# Once exported to CSV. Sort the output by "Type". Then consult the Microsoft Link below to find out what is compatible for migration.
# https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/move-support-resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment