Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.87k forks source link

'Get-AzWebApp -AppServicePlan $asp' doesn't return all deployed Azure Functions within an AppServicePlan #20304

Open michelchristianen opened 1 year ago

michelchristianen commented 1 year ago

Description

Using powershell we try to resolve the number of function-apps deployed within an AppServicePlan using the 'Get-AzWebApp -AppServicePlan $asp' powershell call. Currently it doesn't return all the hosted function-apps, but only 100. After investigating the Azure portal it looks the issue is also available within the Azure portal. Also there only 100 function-apps can be shown. The 'load more' button also doesn't load the additional function-apps that are deployed. So also the Azure portal has a bug. After investigating the requests executed in the Azure Portal using the Network tracing it is working based on the first 100, and than a nextLink url needs to be called. The question is now, should the Get-AzWebApp need to execute the nextLink logic, so retrieve all the available function-apps? If not, please let me know how I can get all the number of function-apps using the Powershell modules, because there is no function or module I can use to call the nextLink logic.

When running the below code it returns this: Retrieving list of FunctionApps from 'ipaas-asp-functions-d' Found 113 FunctionApps But next it only displays the first 100 apps.

Issue script & Debug output

Install-Module Az.Functions -AllowClobber -Force -Scope CurrentUser
Import-Module Az.Functions
Install-Module Az.Websites -AllowClobber -Force -Scope CurrentUser
Import-Module Az.Websites

Write-Host -Verbose "Retrieving list of FunctionApps from 'ipaas-asp-functions-d'"
$asp = Get-AzAppServicePlan -ResourceGroupName "rg-functions-d" -Name "ipaas-asp-functions-d"
$apps = Get-AzWebApp -AppServicePlan $asp
Foreach($app in $apps) 
{ 
    Write-Host -Verbose Stopping FunctionApp $app.Name
    #Stop-AzFunctionApp -Name $app.Name -ResourceGroupName $app.ResourceGroup -Force
}

Environment data

PS C:\dev\git\Internal-Cleanup> $PSVersionTable

Name                           Value                                                                                                                                                          
----                           -----                                                                                                                                                          
PSVersion                      5.1.19041.1682                                                                                                                                                 
PSEdition                      Desktop                                                                                                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                        
BuildVersion                   10.0.19041.1682                                                                                                                                                
CLRVersion                     4.0.30319.42000                                                                                                                                                
WSManStackVersion              3.0                                                                                                                                                            
PSRemotingProtocolVersion      2.3                                                                                                                                                            
SerializationVersion           1.1.0.1

Module versions

PS C:\dev\git\Internal-Cleanup> Get-Module Az*

ModuleType Version    Name                                ExportedCommands                                                                                                                    
---------- -------    ----                                ----------------                                                                                                                    
Script     2.10.3     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                                            
Script     6.4.0      Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}                                          
Script     2.11.5     Az.Websites                         {Add-AzWebAppAccessRestrictionRule, Add-AzWebAppTrafficRouting, Edit-AzWebAppBackupConfiguration, Enter-AzWebAppContainerPSSessio...

Error output

No response

ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

PramodValavala-MSFT commented 1 year ago

@michelchristianen Thanks for the feedback! We will review and update accordingly.