Post-Migration-from-Azure-Automation-Update-Management-to-Azure-Update-Manager-Preqrequisite-Cleanup
This Powershell script will delete all role assignments and delete user managed identity created for migration of machines and software update configurations from Azure Automation Update Management to Azure Update Manager.
This script will do the following:
- Retrieve all machines onboarded to Azure Automation Update Management under this automation account from linked Log Analytics Workspace.
- Delete an automation variable with name AutomationAccountAzureEnvironment created for use in migration.
- Remove the user managed identity from the automation account
- Delete assigned roles to the user managed identity.
- Delete the user managed identity.
The executor of the script should have Microsoft.Authorization/roleAssignments/write action such as Role Based Access Control Administrator on the scopes on which access will be revoked to user managed identity.
Mandatory
Automation Account Resource Id.
Mandatory
Azure Cloud Environment to which Automation Account belongs.
Accepted values are AzureCloud, AzureUSGovernment, AzureChinaCloud.
MigrationPrerequisitesCleanup -AutomationAccountResourceId "/subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Automation/automationAccounts/{aaName}" -AutomationAccountAzureEnvironment "AzureCloud"
The role assignments and user managed identity deleted.