Azure / azure-powershell

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

Get-AzWebapp not returning values under Site Config when run at Subscription Level #22784

Open techcubs opened 1 year ago

techcubs commented 1 year ago

Description

Get-AzWebapp not returning values under Site Config when run at Subscription Level.

$azapps[0].SiteConfig

NumberOfWorkers : 1 DefaultDocuments : NetFrameworkVersion : PhpVersion : PythonVersion : NodeVersion : PowerShellVersion : LinuxFxVersion : WindowsFxVersion : RequestTracingEnabled : RequestTracingExpirationTime : RemoteDebuggingEnabled : RemoteDebuggingVersion : HttpLoggingEnabled : AcrUseManagedIdentityCreds : False AcrUserManagedIdentityID : LogsDirectorySizeLimit : DetailedErrorLoggingEnabled : PublishingUsername : AppSettings : ConnectionStrings : MachineKey : HandlerMappings : DocumentRoot : ScmType : Use32BitWorkerProcess : WebSocketsEnabled : AlwaysOn : False JavaVersion : JavaContainer : JavaContainerVersion : AppCommandLine : ManagedPipelineMode : VirtualApplications : LoadBalancing : Experiments : Limits : AutoHealEnabled : AutoHealRules : TracingOptions : VnetName : VnetRouteAllEnabled : VnetPrivatePortsCount : Cors : Push : ApiDefinition : ApiManagementConfig : AutoSwapSlotName : LocalMySqlEnabled : ManagedServiceIdentityId : XManagedServiceIdentityId : KeyVaultReferenceIdentity : IpSecurityRestrictions : ScmIpSecurityRestrictions : ScmIpSecurityRestrictionsUseMain : Http20Enabled : False MinTlsVersion : ScmMinTlsVersion : FtpsState : PreWarmedInstanceCount : FunctionAppScaleLimit : 200 HealthCheckPath : FunctionsRuntimeScaleMonitoringEnabled : WebsiteTimeZone : MinimumElasticInstanceCount : 0 AzureStorageAccounts : PublicNetworkAccess :

But when we add a -ResourceGroup or target a webapp using -Name then the SiteConfig values are populated. NumberOfWorkers : 1 DefaultDocuments : {Default.htm, Default.html, Default.asp, index.htm…} NetFrameworkVersion : v6.0 PhpVersion : PythonVersion : NodeVersion : PowerShellVersion : LinuxFxVersion : WindowsFxVersion : RequestTracingEnabled : False RequestTracingExpirationTime : RemoteDebuggingEnabled : False RemoteDebuggingVersion : HttpLoggingEnabled : False AcrUseManagedIdentityCreds : AcrUserManagedIdentityID : LogsDirectorySizeLimit : 35 DetailedErrorLoggingEnabled : False PublishingUsername : $AzureFunction-Translater AppSettings : {FUNCTIONS_EXTENSION_VERSION, FUNCTIONS_WORKER_RUNTIME, APPLICATIONINSIGHTS_CONNECTION_STRING, AzureWebJobsStorage…} ConnectionStrings : {} MachineKey : HandlerMappings : DocumentRoot : ScmType : None Use32BitWorkerProcess : True WebSocketsEnabled : False AlwaysOn : False JavaVersion : JavaContainer : JavaContainerVersion : AppCommandLine : ManagedPipelineMode : Integrated VirtualApplications : {Microsoft.Azure.Management.WebSites.Models.VirtualApplication} LoadBalancing : LeastRequests Experiments : Microsoft.Azure.Management.WebSites.Models.Experiments Limits : AutoHealEnabled : False AutoHealRules : TracingOptions : VnetName : VnetRouteAllEnabled : False VnetPrivatePortsCount : Cors : Microsoft.Azure.Management.WebSites.Models.CorsSettings Push : ApiDefinition : ApiManagementConfig : AutoSwapSlotName : LocalMySqlEnabled : False ManagedServiceIdentityId : XManagedServiceIdentityId : KeyVaultReferenceIdentity : IpSecurityRestrictions : {Allow all} ScmIpSecurityRestrictions : {Allow all} ScmIpSecurityRestrictionsUseMain : False Http20Enabled : False MinTlsVersion : 1.2 ScmMinTlsVersion : FtpsState : FtpsOnly PreWarmedInstanceCount : FunctionAppScaleLimit : HealthCheckPath : FunctionsRuntimeScaleMonitoringEnabled : WebsiteTimeZone : MinimumElasticInstanceCount : AzureStorageAccounts : PublicNetworkAccess :

Issue script & Debug output

get-azwebapp
DEBUG: 09:53:58 - GetAzureWebAppCmdlet begin processing with ParameterSet 'S1'.
DEBUG: 09:53:58 - using account id 'REDACTED'...
DEBUG: 09:53:58 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'REDACTED', environment: 'AzureCloud', tenant: 'REDACTED'
DEBUG: 09:53:58 - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 09:53:58 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'REDACTED', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'REDACTED'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - a20d68b8-c365-4de2-ae6e-b081d2c66ac6] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - a20d68b8-c365-4de2-ae6e-b081d2c66ac6] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - a20d68b8-c365-4de2-ae6e-b081d2c66ac6] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - a20d68b8-c365-4de2-ae6e-b081d2c66ac6] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - a20d68b8-c365-4de2-ae6e-b081d2c66ac6] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z] Returning 1 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] MSAL MSAL.NetCore with assembly version '4.49.1.0'. CorrelationId(c0ffd0e1-7b21-43df-ad22-30e9590ec5ee)
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] Access token is not expired. Returning the found cache entry. [Current time (09/13/2023 08:53:58) - Expiration Time (09/13/2023 10:05:09 +00:00) - Extended Expiration Time (09/13/2023 10:05:09 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee]
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - c0ffd0e1-7b21-43df-ad22-30e9590ec5ee]  AT expiration time: 13/09/2023 10:05:09 +00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-09-13T10:05:09.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'REDACTED', UserId: 'REDACTED'
DEBUG: [Common.Authentication]: Authenticating using Account: 'REDACTED', environment: 'AzureCloud', tenant: 'REDACTED'
DEBUG: 09:53:58 - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 09:53:58 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'REDACTED', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'REDACTED'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 9f50f486-4c9c-4992-9160-2088b83a0ed0] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 9f50f486-4c9c-4992-9160-2088b83a0ed0] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 9f50f486-4c9c-4992-9160-2088b83a0ed0] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 9f50f486-4c9c-4992-9160-2088b83a0ed0] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 9f50f486-4c9c-4992-9160-2088b83a0ed0] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z] Returning 1 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] MSAL MSAL.NetCore with assembly version '4.49.1.0'. CorrelationId(6ab538e7-9915-4b82-bfb5-cf2ac0677fac)
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] Access token is not expired. Returning the found cache entry. [Current time (09/13/2023 08:53:58) - Expiration Time (09/13/2023 10:05:09 +00:00) - Extended Expiration Time (09/13/2023 10:05:09 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac]
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:58Z - 6ab538e7-9915-4b82-bfb5-cf2ac0677fac]  AT expiration time: 13/09/2023 10:05:09 +00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-09-13T10:05:09.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'REDACTED', UserId: 'REDACTED'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/REDACTED/resources?$filter=resourceType eq 'Microsoft.Web%2FSites'&api-version=2016-09-01

Headers:
Accept-Language               : en-US
x-ms-client-request-id        : 04b021dd-418f-46fd-8bc4-e913b88da85c

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-request-id               : b7d00b26-499f-456c-b510-f2c26e24434a
x-ms-correlation-request-id   : b7d00b26-499f-456c-b510-f2c26e24434a
x-ms-routing-request-id       : UKSOUTH:20230913T085359Z:b7d00b26-499f-456c-b510-f2c26e24434a
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 13 Sep 2023 08:53:58 GMT

Body:
{
  "value": [
    {
      "id": "/subscriptions/REDACTED/resourceGroups/AzureLearning/providers/Microsoft.Web/sites/AzureFunction-Translater",
      "name": "AzureFunction-Translater",
      "type": "Microsoft.Web/sites",
      "kind": "functionapp",
      "location": "eastus",
      "tags": {
        "hidden-link: /app-insights-resource-id": "/subscriptions/REDACTED/resourceGroups/AzureLearning/providers/microsoft.insights/components/AzureFunction-Translater",
        "hidden-link: /app-insights-instrumentation-key": "REDACTED",
        "hidden-link: /app-insights-conn-string": "InstrumentationKey=REDACTED;IngestionEndpoint=REDACTED",        "ReportingProductTag": "REDACTED",
        "ReportingDepartmentTag": "REDACTED",
        "ReportingFamilyTag": "REDACTED"
      }
    },
    {
      "id": "/subscriptions/REDACTED/resourceGroups/AzureLearning/providers/Microsoft.Web/sites/AzureWebApp-REDACTED",
      "name": "AzureWebApp-REDACTED",
      "type": "Microsoft.Web/sites",
      "kind": "app",
      "location": "eastus",
      "tags": {
        "ReportingProductTag": "REDACTED",
        "ReportingDepartmentTag": "REDACTED",
        "ReportingFamilyTag": "REDACTED"
      }
    }
  ]
}

DEBUG: [Common.Authentication]: Authenticating using Account: 'REDACTED', environment: 'AzureCloud', tenant: 'REDACTED'
DEBUG: 09:53:59 - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 09:53:59 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'REDACTED', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'REDACTED'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - ab159aa0-75a1-4e70-8602-07ab0520c728] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - ab159aa0-75a1-4e70-8602-07ab0520c728] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - ab159aa0-75a1-4e70-8602-07ab0520c728] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - ab159aa0-75a1-4e70-8602-07ab0520c728] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - ab159aa0-75a1-4e70-8602-07ab0520c728] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z] Returning 1 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] MSAL MSAL.NetCore with assembly version '4.49.1.0'. CorrelationId(febd6873-438f-4bc5-a8a8-2fd22818b1a8)
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - febd6873-438f-4bc5-a8a8-2fd22818b1a8
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] Access token is not expired. Returning the found cache entry. [Current time (09/13/2023 08:53:59) - Expiration Time (09/13/2023 10:05:09 +00:00) - Extended Expiration Time (09/13/2023 10:05:09 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8]
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.9 Microsoft Windows 10.0.22621 [2023-09-13 08:53:59Z - febd6873-438f-4bc5-a8a8-2fd22818b1a8]  AT expiration time: 13/09/2023 10:05:09 +00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-09-13T10:05:09.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'REDACTED', UserId: 'REDACTED'

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.15.1                Az.Websites                         {Add-AzWebAppAccessRestrictionRule, Add-AzWebAppTrafficRouting, Edit-AzWebAppBackupConfiguration, Enter-AzWebAppContainerPSSession…}

Error output

No response

microsoft-github-policy-service[bot] commented 1 year ago

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

swsr-capco commented 9 months ago

I am working on a compliance project to know if there is publicNetworkAccess enabled for public access for a web app

Would love to see what scripts can be used to get this value

my script so far

`$webapp = (get-azwebapp -resourcegroupname $WebAppRGName  -name $WebAppName)
$webapp | Get-Member
#.publicNetworkAccess cannot find anyting for this

# we get firewall rules from here
#$ipsecurityrestrictions = (get-azwebapp -resourcegroupname $WebAppRGName  -name $WebAppName).siteconfig.ipsecurityrestrictions
#$ipsecurityrestrictions`
o-l-a-v commented 3 months ago

@swsr-capco

You can use the Azure RM API directly like this:

# Get all web apps for current subscription using the Azure RM API directly
$WebApps = [array](
    (
        (
            Invoke-AzRestMethod -Method 'Get' -Path (
                '/subscriptions/{0}/providers/microsoft.web/sites?api-version=2023-12-01' -f (Get-AzContext).'Subscription'.'Id'
            )
        ).'Content' | ConvertFrom-Json
    ).'value'
)

# Show the attribute of one of the apps
$WebApps[0].'properties'.'publicNetworkAccess'

# Group by the attribute
$WebApps | Group-Object -Property @{'Expression'={$_.'properties'.'publicNetworkAccess'}} -NoElement

One observation: Seems publicNetworkAccess isn't neccessarily populated. In my example I had 33 web apps, all have public network access enabled.

Count Name
----- ----
   27
    6 Enabled

So this might be a API / provider issue? For checking compliance: Unless the value is Disabled, assume it's enabled?

lzandman commented 2 months ago

You can use the Azure RM API directly like this:

That's how I did it too. But I hope official support for this property is added soon.

One observation: Seems publicNetworkAccess isn't neccessarily populated. In my example I had 33 web apps, all have public network access enabled. So this might be a API / provider issue? For checking compliance: Unless the value is Disabled, assume it's enabled?

Yeah, haven't figured out its behaviour. Seeing this on Key Vault and Function Apps too, though Get-AzFunctionApp and Get-AzKeyVault do return the public PublicNetworkAccess property. However, the property is read-only. Cannot set it. Maybe its value is inferred from other networking settings?