azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Need Power shell Script to get the reports from Pass services

Open IronmanM opened this issue 7 years ago • 9 comments

  • Get the Firewall and Virtual Network rules details all (Key Vault, Storage Accounts, Data Lake Store, Data Lake Analytics, Event Hubs, Function Apps, Web Apps, Logic Apps)
  • Get all users/apps that have access reports

Thank you.

IronmanM avatar Nov 07 '19 03:11 IronmanM

Hello @IronmanM , could you describe more details about

  • your scenarios
  • how current Az cannot solve your problem
  • and how do you think we can improve Thanks

isra-fel avatar Nov 07 '19 05:11 isra-fel

we are using the below commands to get the resource information.

Connect-AzureRmAccount 
Set-AzureRmContext -SubscriptionId 4e3b720e-12X3-4XXXc-a35a-bXYXYXXXXbYYX
Get-AzureRmResource | Export-Csv -Path "C:\azureinventory.csv" ###AzureInventory

For VMs inventory below command ;

  [string]$tenantId="",
    [string]$file="Azure-ARM-VMs.csv"
) 

if ($tenantId -eq "") {
    login-azurermaccount 
    $subs = Get-AzureRmSubscription 
} else {
    login-azurermaccount -tenantid $tenantId 
    $subs = Get-AzureRmSubscription -TenantId $tenantId 
}


$vmobjs = @()

foreach ($sub in $subs)
{
    
    Write-Host Processing subscription $sub.SubscriptionName

    try
    {

        Select-AzureRmSubscription -SubscriptionId $sub.SubscriptionId -ErrorAction Continue

        $vms = Get-AzureRmVm 

        foreach ($vm in $vms)
        {
            $vmInfo = [pscustomobject]@{
                'Subscription'=$sub.SubscriptionName
                'Mode'='ARM'
                'Name'=$vm.Name
                'ResourceGroupName' = $vm.ResourceGroupName
                'Location' = $vm.Location
                'VMSize' = $vm.HardwareProfile.VMSize
                'Status' = $null
                'AvailabilitySet' = $vm.AvailabilitySetReference.Id }
        
            $vmStatus = $vm | Get-AzureRmVM -Status
            $vmInfo.Status = $vmStatus.Statuses[1].DisplayStatus

            $vmobjs += $vmInfo

        }  
    }
    catch
    {
        Write-Host $error[0]
    }
}

$vmobjs | Export-Csv -NoTypeInformation -Path $file
Write-Host "VM list written to $file"

So, I need the PaaS services reports what configuration is there and how we should get the reports (like Vnet and firewall rules)

IronmanM avatar Nov 07 '19 05:11 IronmanM

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @karenhammons @sfiguemsft

ghost avatar Nov 07 '19 05:11 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @karenhammons @sfiguemsft

ghost avatar Nov 07 '19 05:11 ghost

@KarenHammons , @sfiguemsft @isra-fel Just checking is there any update on it.

IronmanM avatar Nov 11 '19 03:11 IronmanM

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc

ghost avatar Nov 21 '19 22:11 ghost

@KarenHammons who is the Firewall contact for this?

allegradomel avatar Dec 20 '19 23:12 allegradomel

Have you tried Get-AzFirewall?

https://docs.microsoft.com/en-us/powershell/module/az.network/get-azfirewall?view=azps-3.3.0

The firewall JSON should contain all the information you need.

yairt1974 avatar Jan 23 '20 21:01 yairt1974

Sure, I will try to thank you.

IronmanM avatar Jan 24 '20 14:01 IronmanM