Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.82k forks source link

Get-AzureRmWebApp not showing result #19149

Closed yeseo1018 closed 2 years ago

yeseo1018 commented 2 years ago

Description

Newly created function apps are not showing up on the Get-AzureRmWebApp, but when I try Set-AzureRmWebApp result is showing.

Issue script & Debug output

$DebugPreference = "Continue"
>>
>> $webApp = Get-AzureRmWebApp -Name [EDIT]
>> Write-Output ("Resource Group : {0}" -f $webApp.ResourceGroup)
>> Write-Output ("DoesNotExist : {0}" -f $webApp.DoesNotExist)
Resource Group :
DoesNotExist :

Set-AzureRmWebApp -Name [EDIT] -ResourceGroupName [EDIT]

SiteName                  : [EDIT]
State                     : Running
HostNames                 : {[EDIT].azureservices.[EDIT].com}
RepositorySiteName        : [EDIT]
UsageState                : Normal
Enabled                   : True
EnabledHostNames          : {[EDIT].azureservices.[EDIT].com, [EDIT].scm.azureservices.[EDIT].com}
AvailabilityState         : Normal
HostNameSslStates         : {[EDIT].azureservices.[EDIT].com, [EDIT].scm.azureservices.[EDIT].com}
ServerFarmId              : /subscriptions/[EDIT]/resourceGroups/[EDIT]/providers/Microsoft.Web/serverfarms/[EDIT]
LastModifiedTimeUtc       : 4/08/2022 7:15:20 AM
SiteConfig                : Microsoft.Azure.Management.WebSites.Models.SiteConfig
TrafficManagerHostNames   :
PremiumAppDeployed        :
ScmSiteAlsoStopped        : False
TargetSwapSlot            :
HostingEnvironmentProfile : Microsoft.Azure.Management.WebSites.Models.HostingEnvironmentProfile
MicroService              :
GatewaySiteName           :
ClientAffinityEnabled     : False
ClientCertEnabled         : False
HostNamesDisabled         : False
OutboundIpAddresses       : [Edit]
ContainerSize             : 1536
MaxNumberOfWorkers        :
CloningInfo               :
ResourceGroup             : [EDIT]
IsDefaultContainer        :
DefaultHostName           : [EDIT].azureservices.com
Id                        : /subscriptions/[EDIT]/resourceGroups/[EDIT]/providers/Microsoft.Web/sites/[EDIT]
Name                      : [EDIT]
Location                  : Australia Southeast
Type                      : Microsoft.Web/sites

Environment data

$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

Get-Module AzureRM*

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.5.0      AzureRM
Script     4.6.0      AzureRM.Compute                     {Add-AzureRmContainerServiceAgentPoolProfile, Add-AzureRmImageDataDisk, Add-AzureRmVhd, Add-AzureRmVMAddition...
Script     4.6.0      AzureRM.Profile                     {Add-AzureRmEnvironment, Clear-AzureRmContext, Clear-AzureRmDefault, Connect-AzureRmAccount...}
Script     4.2.2      AzureRM.Websites                    {Edit-AzureRmWebAppBackupConfiguration, Get-AzureRmAppServicePlan, Get-AzureRmAppServicePlanMetrics, Get-Azur...

Error output

No response

dingmeng-xue commented 2 years ago

Thanks for reporting. Could you just execute cmdlet Get-AzureRmWebApp -Name [EDIT] again after you turn on debug log? There is request and response in log. Please share it to us.

Another possibility is due to API version. Could you try Get-AzWebApp using the latest Az.Websites?

ghost commented 2 years ago

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

yeseo1018 commented 2 years ago

DEBUG: AzureQoSEvent: CommandName - Get-AzureRmWebApp; IsSuccess - True; Duration - 00:00:02.5039407; Exception - ; DEBUG: Finish sending metric. DEBUG: 9:53:36 AM - GetAzureWebAppCmdlet end processing. DEBUG: 9:53:36 AM - GetAzureWebAppCmdlet end processing.

This is all I could share as tonnes of other app removed the previous log.

Get-AzWebApp this worked

dingmeng-xue commented 2 years ago

Thanks for sharing. It should relate to API version. How did you create the WebApp?

yeseo1018 commented 2 years ago

I have created through pipeline just like other apps

yeseo1018 commented 2 years ago

Here is the task

task: AzureResourceGroupDeployment@2
      displayName: Deploy App Service 
      condition: and(eq(variables['doWebApp'], '1'), eq(variables['parameterFileExists'], true))
      inputs:
        azureSubscription: $(Subscription)
        resourceGroupName: $(ResourceGroupName)
        location: $(Location)
        csmFile: ARMTemplates/AppService/fa-template.json
        csmParametersFile: ARMTemplates/AppService/[EDIT]-$(SettingToken)-parameters.json
        deploymentName: ARMTemplateDeployment-FunctionApp-[EDIT]
dingmeng-xue commented 2 years ago

Got it. I believe Webapp is created using the new API but AzureRm module still uses old version. Please consider to upgrade your module to the latest Az. I'm not sure service team plans to make API consistent.

navba-MSFT commented 2 years ago

@yeseo1018 Apologies for the late reply. Thanks for reaching out to us and reporting this issue.

Our recommendation is to use Get-AzWebApp PS cmdlet. Because we'll retire AzureRM PowerShell modules on 29 February 2024. Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more,

To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024.

Also I see that you are using an older version of AzureRM.Websites. You can also try to update AzureRM.Websites module to the most recent version and check if that helps. Awaiting your reply.

navba-MSFT commented 2 years ago

@yeseo1018 I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you need any further assistance on this. Awaiting your reply.

yeseo1018 commented 2 years ago

Updating to the latest version of AzureRm.Websites still did not worked. Will upgrade to AZ modules as they work fine. Thank you