Azure / azure-powershell

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

Get-AzFirewall fails #21676

Closed superjoe2000 closed 1 year ago

superjoe2000 commented 1 year ago

Description

Get-AzFirewall: GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxIntegerT' violates the constraint of type 'T'.

Issue script & Debug output

PS C:\Users\joclemen\OneDrive - Microsoft\Documents\DevOps\joeslab\GM_CCOE> Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578fw
DEBUG: 4:26:52 PM - GetAzureFirewallCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 4:26:52 PM - using account id 'admin@MngEnv024722.onmicrosoft.com'...
DEBUG: 4:26:52 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'admin@MngEnv024722.onmicrosoft.com', environment: 'AzureCloud', tenant: '11d3b903-67a9-4a3d-ae57-938b6ece3b4b'
DEBUG: 4:26:52 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'11d3b903-67a9-4a3d-ae57-938b6ece3b4b', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'admin@MngEnv024722.onmicrosoft.com'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82 - 0dd3d674-c2ed-4b1b-8208-4a9b505eddbf] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82] Found 5 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.82] Returning 5 accounts
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] MSAL MSAL.NetCore with assembly version '4.39.0.0'. CorrelationId(1df15074-ce3c-4dc5-b6a7-9a63a4f93616)
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] LoginHint provided: False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] Account provided: True
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] ForceRefresh: False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] 
=== 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 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616
UserAssertion set: False
LongRunningOboCacheKey set: False

DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] Access token is not expired. Returning the found cache entry. [Current time (04/28/2023 21:26:52) - Expiration Time (04/28/2023 22:31:42 +00:00) - Extended Expiration Time (04/28/2023 22:31:42 +00:00)]
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] Fetched access token from host login.microsoftonline.com.    
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616] 
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.39.0.0 MSAL.NetCore .NET 7.0.5 Microsoft Windows 10.0.22621 [04/28 21:26:52.83 - 1df15074-ce3c-4dc5-b6a7-9a63a4f93616]  AT expiration time: 4/28/2023 10:31:42 PM +00:00, scopes https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default source Cache from login.microsoftonline.com appHashCode 2618904
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-04-28T22:31:42.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '11d3b903-67a9-4a3d-ae57-938b6ece3b4b', UserId: 'admin@MngEnv024722.onmicrosoft.com'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/azureFirewalls/a203578fw?api-version=2021-05-01     

Headers:
Accept-Language               : en-US
x-ms-client-request-id        : 25a58720-34c7-4f20-a7f4-540a822bc3ce

Body:

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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
ETag                          : W/"f4e6e7f2-6617-434b-af7d-0a2b0d3fc932"
x-ms-request-id               : 2491e4b5-e044-480b-9c82-8ad6e39fb95a
x-ms-correlation-request-id   : 3fd34949-b515-4c26-9899-1cf3a58e3f38
x-ms-arm-service-request-id   : b5c83450-2f40-4f6f-bc31-55396c5c3f20
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-routing-request-id       : SOUTHCENTRALUS:20230428T212653Z:3fd34949-b515-4c26-9899-1cf3a58e3f38
X-Content-Type-Options        : nosniff
Date                          : Fri, 28 Apr 2023 21:26:53 GMT

Body:
{
  "name": "a203578fw",
  "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/azureFirewalls/a203578fw",
  "etag": "W/\"f4e6e7f2-6617-434b-af7d-0a2b0d3fc932\"",
  "type": "Microsoft.Network/azureFirewalls",
  "location": "eastus2",
  "tags": {},
  "properties": {
    "provisioningState": "Succeeded",
    "sku": {
      "name": "AZFW_VNet",
      "tier": "Standard"
    },
    "threatIntelMode": "Alert",
    "additionalProperties": {},
    "managementIpConfiguration": {
      "name": "a203578fw-mgmt-pip",
      "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/azureFirewalls/a203578fw/azureFirewallIpConfigurations/a203578fw-mgmt-pip",
      "etag": "W/\"f4e6e7f2-6617-434b-af7d-0a2b0d3fc932\"",
      "type": "Microsoft.Network/azureFirewalls/azureFirewallIpConfigurations",
      "properties": {
        "provisioningState": "Succeeded",
        "privateIPAllocationMethod": "Dynamic",
        "publicIPAddress": {
          "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/publicIPAddresses/a203578fw-mgmt-pip"
        },
        "subnet": {
          "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/virtualNetworks/a203578-dt1-musea2-vnet001/subnets/AzureFirewallManagementSubnet"
        }
      }
    },
    "ipConfigurations": [
      {
        "name": "a293578fw-pip",
        "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/azureFirewalls/a203578fw/azureFirewallIpConfigurations/a293578fw-pip",
        "etag": "W/\"f4e6e7f2-6617-434b-af7d-0a2b0d3fc932\"",
        "type": "Microsoft.Network/azureFirewalls/azureFirewallIpConfigurations",
        "properties": {
          "provisioningState": "Succeeded",
          "privateIPAddress": "10.233.16.68",
          "privateIPAllocationMethod": "Dynamic",
          "publicIPAddress": {
            "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/publicIPAddresses/a293578fw-pip"
          },
          "subnet": {
            "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourceGroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/virtualNetworks/a203578-dt1-musea2-vnet001/subnets/AzureFirewallSubnet"
          }
        }
      }
    ],
    "networkRuleCollections": [],
    "applicationRuleCollections": [],
    "natRuleCollections": [],
    "firewallPolicy": {
      "id": "/subscriptions/9fa642e3-4211-4d88-b4a4-effb9af9ed02/resourcegroups/a203578-dt1-musea2-rg001/providers/Microsoft.Network/firewallPolicies/fwpolicystandard"
    }
  }
}

DEBUG: 4:26:53 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
Get-AzFirewall: GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.
DEBUG: 4:26:53 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Network:4.13.0; CommandName: Get-AzFirewall; PSVersion: 7.3.4; IsSuccess: False; Duration: 00:00:00.4287767; Exception: GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.;
DEBUG: Finish sending metric.
DEBUG: 4:26:53 PM - GetAzureFirewallCommand end processing.
P

Environment data

PS C:\Users\joclemen\OneDrive - Microsoft\Documents\DevOps\joeslab\GM_CCOE> $PSVersionTable   

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
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

PS C:\Users\joclemen\OneDrive - Microsoft\Documents\DevOps\joeslab\GM_CCOE> Get-Module Az
PS C:\Users\joclemen\OneDrive - Microsoft\Documents\DevOps\joeslab\GM_CCOE> Get-Module -ListAvailable

    Directory: C:\Users\joclemen\OneDrive - Microsoft\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     9.7.1                 Az                                  Core,Desk
Script     7.0.0                 Az                                  Core,Desk
Script     2.12.2                Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave…}
Script     2.9.1                 Az.Accounts                         Core,Desk {Disable-

Error output

PS C:\Users\joclemen\OneDrive - Microsoft\Documents\DevOps\joeslab\GM_CCOE> Resolve-AzError
DEBUG: 4:30:37 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 4:30:37 PM - using account id 'admin@MngEnv024722.onmicrosoft.com'...
DEBUG: 4:30:37 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

   HistoryId: 24

Message        : GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.  
StackTrace     :    at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
                    at AutoMapper.TypeDetails.<>c.<BuildPublicNoArgExtensionMethods>b__30_7(<>f__AnonymousType18`2 <>h__TransparentIdentifier1)
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
                    at System.Linq.Enumerable.UnionIterator`1.FillSet()
                    at System.Linq.Enumerable.UnionIterator`1.ToArray()
                    at AutoMapper.TypeDetails.BuildPublicNoArgExtensionMethods(IEnumerable`1 sourceExtensionMethodSearch)
                    at AutoMapper.TypeDetails..ctor(Type type, ProfileMap config)
                    at AutoMapper.LockingConcurrentDictionary`2.<>c__DisplayClass2_1.<.ctor>b__1()
                    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
                    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
                    at System.Lazy`1.CreateValue()
                    at AutoMapper.Configuration.Conventions.NameSplitMember.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String       
                 nameToSearch, LinkedList`1 resolvers, IMemberConfiguration parent)
                    at AutoMapper.Configuration.Conventions.MemberConfiguration.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String   
                 nameToSearch, LinkedList`1 resolvers)
                    at AutoMapper.TypeMapFactory.<>c__DisplayClass1_0.<MapDestinationPropertyToSource>b__0(IMemberConfiguration _)
                    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
                    at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options)
                    at AutoMapper.ProfileMap.BuildTypeMap(TypeMapRegistry typeMapRegistry, ITypeMapConfiguration config)
                    at AutoMapper.ProfileMap.Register(TypeMapRegistry typeMapRegistry)
                    at AutoMapper.MapperConfiguration.Seal()
                    at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
                    at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.Initialize()
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.get_Mapper()
                    at Microsoft.Azure.Commands.Network.AzureFirewallBaseCmdlet.GetAzureFirewall(String resourceGroupName, String name)
                    at Microsoft.Azure.Commands.Network.GetAzureFirewallCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentException
InvocationInfo : {Get-AzFirewall}
Line           : Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578fw
Position       : At line:1 char:1
                 + Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203 …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 24

Message        : Method System.Linq.Enumerable.MaxInteger: type argument 'Microsoft.Azure.Management.Network.Models.SecurityRule' violates the constraint of type parameter 'T'.
StackTrace     :    at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
Exception      : System.Security.VerificationException
InvocationInfo : {Get-AzFirewall}
Line           : Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578fw
Position       : At line:1 char:1
                 + Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203 …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 24

   HistoryId: 23

Message        : GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.  
StackTrace     :    at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
                    at AutoMapper.TypeDetails.<>c.<BuildPublicNoArgExtensionMethods>b__30_7(<>f__AnonymousType18`2 <>h__TransparentIdentifier1)
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
                    at System.Linq.Enumerable.UnionIterator`1.FillSet()
                    at System.Linq.Enumerable.UnionIterator`1.ToArray()
                    at AutoMapper.TypeDetails.BuildPublicNoArgExtensionMethods(IEnumerable`1 sourceExtensionMethodSearch)
                    at AutoMapper.TypeDetails..ctor(Type type, ProfileMap config)
                    at AutoMapper.LockingConcurrentDictionary`2.<>c__DisplayClass2_1.<.ctor>b__1()
                    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
                    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
                    at System.Lazy`1.CreateValue()
                    at AutoMapper.Configuration.Conventions.NameSplitMember.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String       
                 nameToSearch, LinkedList`1 resolvers, IMemberConfiguration parent)
                    at AutoMapper.Configuration.Conventions.MemberConfiguration.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String   
                 nameToSearch, LinkedList`1 resolvers)
                    at AutoMapper.TypeMapFactory.<>c__DisplayClass1_0.<MapDestinationPropertyToSource>b__0(IMemberConfiguration _)
                    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
                    at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options)
                    at AutoMapper.ProfileMap.BuildTypeMap(TypeMapRegistry typeMapRegistry, ITypeMapConfiguration config)
                    at AutoMapper.ProfileMap.Register(TypeMapRegistry typeMapRegistry)
                    at AutoMapper.MapperConfiguration.Seal()
                    at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
                    at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.Initialize()
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.get_Mapper()
                    at Microsoft.Azure.Commands.Network.AzureFirewallBaseCmdlet.GetAzureFirewall(String resourceGroupName, String name)
                    at Microsoft.Azure.Commands.Network.GetAzureFirewallCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentException
InvocationInfo : {Get-AzFirewall}
Line           : Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578fw
Position       : At line:1 char:1
                 + Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203 …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 23

Message        : Method System.Linq.Enumerable.MaxInteger: type argument 'Microsoft.Azure.Management.Network.Models.SecurityRule' violates the constraint of type parameter 'T'.
StackTrace     :    at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
Exception      : System.Security.VerificationException
InvocationInfo : {Get-AzFirewall}
Line           : Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578fw
Position       : At line:1 char:1
                 + Get-AzFirewall -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203 …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 23

   HistoryId: 20

Message        : GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.  
StackTrace     :    at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
                    at AutoMapper.TypeDetails.<>c.<BuildPublicNoArgExtensionMethods>b__30_7(<>f__AnonymousType18`2 <>h__TransparentIdentifier1)
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
                    at System.Linq.Enumerable.UnionIterator`1.FillSet()
                    at System.Linq.Enumerable.UnionIterator`1.ToArray()
                    at AutoMapper.TypeDetails.BuildPublicNoArgExtensionMethods(IEnumerable`1 sourceExtensionMethodSearch)
                    at AutoMapper.TypeDetails..ctor(Type type, ProfileMap config)
                    at AutoMapper.LockingConcurrentDictionary`2.<>c__DisplayClass2_1.<.ctor>b__1()
                    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
                    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
                    at System.Lazy`1.CreateValue()
                    at AutoMapper.Configuration.Conventions.NameSplitMember.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String       
                 nameToSearch, LinkedList`1 resolvers, IMemberConfiguration parent)
                    at AutoMapper.Configuration.Conventions.MemberConfiguration.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String   
                 nameToSearch, LinkedList`1 resolvers)
                    at AutoMapper.TypeMapFactory.<>c__DisplayClass1_0.<MapDestinationPropertyToSource>b__0(IMemberConfiguration _)
                    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
                    at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options)
                    at AutoMapper.ProfileMap.BuildTypeMap(TypeMapRegistry typeMapRegistry, ITypeMapConfiguration config)
                    at AutoMapper.ProfileMap.Register(TypeMapRegistry typeMapRegistry)
                    at AutoMapper.MapperConfiguration.Seal()
                    at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
                    at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.Initialize()
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.get_Mapper()
                    at Microsoft.Azure.Commands.Network.VirtualNetworkBaseCmdlet.GetVirtualNetwork(String resourceGroupName, String name, String expandResource)
                    at Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkCommand.Execute()
                    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentException
InvocationInfo : {Get-AzVirtualNetwork}
Line           : $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578-dt1-musea2-vnet001
Position       : At line:1 char:9
                 + $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg …
                 +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 20

Message        : Method System.Linq.Enumerable.MaxInteger: type argument 'Microsoft.Azure.Management.Network.Models.SecurityRule' violates the constraint of type parameter 'T'.
StackTrace     :    at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
Exception      : System.Security.VerificationException
InvocationInfo : {Get-AzVirtualNetwork}
Line           : $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578-dt1-musea2-vnet001
Position       : At line:1 char:9
                 + $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg …
                 +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 20

   HistoryId: 15

Message        : GenericArguments[0], 'Microsoft.Azure.Management.Network.Models.SecurityRule', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.  
StackTrace     :    at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
                    at AutoMapper.TypeDetails.<>c.<BuildPublicNoArgExtensionMethods>b__30_7(<>f__AnonymousType18`2 <>h__TransparentIdentifier1)
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
                    at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
                    at System.Linq.Enumerable.UnionIterator`1.FillSet()
                    at System.Linq.Enumerable.UnionIterator`1.ToArray()
                    at AutoMapper.TypeDetails.BuildPublicNoArgExtensionMethods(IEnumerable`1 sourceExtensionMethodSearch)
                    at AutoMapper.TypeDetails..ctor(Type type, ProfileMap config)
                    at AutoMapper.LockingConcurrentDictionary`2.<>c__DisplayClass2_1.<.ctor>b__1()
                    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
                    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
                    at System.Lazy`1.CreateValue()
                    at AutoMapper.Configuration.Conventions.NameSplitMember.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String 
                 nameToSearch, LinkedList`1 resolvers, IMemberConfiguration parent)
                    at AutoMapper.Configuration.Conventions.MemberConfiguration.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String   
                 nameToSearch, LinkedList`1 resolvers)
                    at AutoMapper.TypeMapFactory.<>c__DisplayClass1_0.<MapDestinationPropertyToSource>b__0(IMemberConfiguration _)
                    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
                    at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options)
                    at AutoMapper.ProfileMap.BuildTypeMap(TypeMapRegistry typeMapRegistry, ITypeMapConfiguration config)
                    at AutoMapper.ProfileMap.Register(TypeMapRegistry typeMapRegistry)
                    at AutoMapper.MapperConfiguration.Seal()
                    at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
                    at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.Initialize()
                    at Microsoft.Azure.Commands.Network.NetworkResourceManagerProfile.get_Mapper()
                    at Microsoft.Azure.Commands.Network.VirtualNetworkBaseCmdlet.GetVirtualNetwork(String resourceGroupName, String name, String expandResource)
                    at Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkCommand.Execute()
                    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentException
InvocationInfo : {Get-AzVirtualNetwork}
Line           : $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578-dt1-musea2-vnet001
Position       : At line:1 char:9
                 + $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg …
                 +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 15

Message        : Method System.Linq.Enumerable.MaxInteger: type argument 'Microsoft.Azure.Management.Network.Models.SecurityRule' violates the constraint of type parameter 'T'.
StackTrace     :    at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
                    at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
Exception      : System.Security.VerificationException
InvocationInfo : {Get-AzVirtualNetwork}
Line           : $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg001 -Name a203578-dt1-musea2-vnet001
Position       : At line:1 char:9
                 + $vnet = Get-AzVirtualNetwork -ResourceGroupName a203578-dt1-musea2-rg …
                 +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 15

   HistoryId: 11

Message        : Module 'Az' was not installed by using Install-Module, so it cannot be updated.
StackTrace     : 
Exception      : Microsoft.PowerShell.Commands.WriteErrorException
InvocationInfo : {Update-Module}
Line           : Update-Module Az -Force
Position       : At line:1 char:1
                 + Update-Module Az -Force
                 + ~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 11

Message        : No match was found for the specified search criteria and module names 'Az'.
StackTrace     : 
Exception      : System.Exception
InvocationInfo : {Get-Package}
Line           :             $installedPackages = PackageManagement\Get-Package @GetPackageParameters

Position       : At C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:13015 char:34
                 + … stalledPackages = PackageManagement\Get-Package @GetPackageParameters
                 +                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 11
isra-fel commented 1 year ago

Hi @superjoe2000 the list of modules indicated there are multiple versions of Az getting installed. Could you try uninstalling all of them and install the latest Az?

superjoe2000 commented 1 year ago

Yeming,

I thought I had cleaned out and had a good install before I posted. Today I deleted all instances and reinstalled. Immediately I was presented with an update azure-cli: 2.48.1.

PS C:\ > az version { "azure-cli": "2.48.1", "azure-cli-core": "2.48.1", "azure-cli-telemetry": "1.0.8", "extensions": { "azure-devops": "0.26.0", "devcenter": "0.1.2", "resource-graph": "2.1.0" } }

Now the Get-AzFirewall command works for me.

Thanks,

Joe Clemens Senior Cloud Solutions Architect - Engineering Azure Core US Enterprise Commercial Office: +1.469.755.0087 Mobile: +1.972.822.6224 [Graphical user interface, text, application Description automatically @.**@.>

[Diagram Description automatically generated]

From: Yeming Liu @.> Sent: Monday, May 1, 2023 7:54 AM To: Azure/azure-powershell @.> Cc: Joe Clemens @.>; Mention @.> Subject: Re: [Azure/azure-powershell] Get-AzFirewall fails (Issue #21676)

Hi @superjoe2000https://github.com/superjoe2000 the list of modules indicated there are multiple versions of Az getting installed. Could you try uninstalling all of them and install the latest Az?

- Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-powershell/issues/21676#issuecomment-1529680899, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQWLK7VRH7PDIZ7QQSGB67LXD6W5HANCNFSM6AAAAAAXPXKI4M. You are receiving this because you were mentioned.Message ID: @.**@.>>

isra-fel commented 1 year ago

No worries. Let me close this issue.