From 3885a0aed72bced8c332e952e1f8aa2ccb365f43 Mon Sep 17 00:00:00 2001 From: Martin Zurita Date: Sat, 4 May 2019 11:16:48 -0300 Subject: [PATCH] Update Find-WhoAmI Updated commands for the new Az libraries --- Utility/ARM/Find-WhoAmI | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Utility/ARM/Find-WhoAmI b/Utility/ARM/Find-WhoAmI index 178264b..669668c 100644 --- a/Utility/ARM/Find-WhoAmI +++ b/Utility/ARM/Find-WhoAmI @@ -15,23 +15,24 @@ .NOTES AUTHOR: Azure/OMS Automation Team - LASTEDIT: June 30, 2016 + LASTEDIT: May 4, 2019 + UPDATED FOR AZ MODULE: Martin Zurita #> $ServicePrincipalConnection = Get-AutomationConnection -Name "AzureRunAsConnection" -Add-AzureRmAccount ` +Add-AzAccount ` -ServicePrincipal ` -TenantId $ServicePrincipalConnection.TenantId ` -ApplicationId $ServicePrincipalConnection.ApplicationId ` -CertificateThumbprint $ServicePrincipalConnection.CertificateThumbprint | Write-Verbose -Select-AzureRmSubscription -SubscriptionId $ServicePrincipalConnection.SubscriptionID | Write-Verbose +Select-AzSubscription -SubscriptionId $ServicePrincipalConnection.SubscriptionID | Write-Verbose -$AutomationResource = Get-AzureRmResource -ResourceType Microsoft.Automation/AutomationAccounts -ExtensionResourceName Microsoft.Automation +$AutomationResource = Get-AzResource -ResourceType Microsoft.Automation/AutomationAccounts foreach ($Automation in $AutomationResource) { - $Job = Get-AzureRmAutomationJob -ResourceGroupName $Automation.ResourceGroupName -AutomationAccountName $Automation.Name -Id $PSPrivateMetadata.JobId.Guid -ErrorAction SilentlyContinue + $Job = Get-AzAutomationJob -ResourceGroupName $Automation.ResourceGroupName -AutomationAccountName $Automation.Name -Id $PSPrivateMetadata.JobId.Guid -ErrorAction SilentlyContinue if (!([string]::IsNullOrEmpty($Job))) { $AutomationInformation = @{}