Azure / Azure/azure-powershell
[Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
I got issue with working with the PowerShell script, no matter if it is created in local or in runbook. I try to clean images from image gallery. When the definition has only one version of image, I can not use .indexof method. I am using the indexof method to check which image is the latest as there is no such info in PowerShell or azure cli output.
### Issue script & Debug output
```PowerShell
Gathering versions for VM Image definition: ubuntu2004-ado-agent
DEBUG: 1:55:12 PM - GetAzureRmGalleryImageVersion begin processing with ParameterSet 'DefaultParameter'.
DEBUG: 1:55:12 PM - using account id ''...
DEBUG: 1:55:12 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '', environment: 'AzureCloud', tenant: ''
DEBUG: 1:55:12 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:''
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - 59314f38-bc9b-4f54-bbbf-8d47fd974f38] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - 59314f38-bc9b-4f54-bbbf-8d47fd974f38] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - 59314f38-bc9b-4f54-bbbf-8d47fd974f38] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - 59314f38-bc9b-4f54-bbbf-8d47fd974f38] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - 59314f38-bc9b-4f54-bbbf-8d47fd974f38] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - 59314f38-bc9b-4f54-bbbf-8d47fd974f38] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z] [WamBroker] Not a Win10 machine. WAM is not available
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z] NullBroker - acting as not installed.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z] Found 2 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z] Returning 2 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] MSAL MSAL.NetCore with assembly version '4.49.1.0'. CorrelationId(bac76d56-6619-41e7-b60b-a66b1bb2c8c8)
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8]
=== 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 - True
HomeAccountId - False
CorrelationId - bac76d56-6619-41e7-b60b-a66b1bb2c8c8
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] === 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.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] Access token is not expired. Returning the found cache entry. [Current time (03/10/2023 12:55:12) - Expiration Time (03/10/2023 13:48:54 +00:00) - Extended Expiration Time (03/10/2023 13:48:54 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 [2023-03-10 12:55:12Z - bac76d56-6619-41e7-b60b-a66b1bb2c8c8] AT expiration time: 3/10/2023 1:48:54 PM +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-03-10T13:48:54.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '', UserId: ''
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions//resourceGroups/APP518-SIG-PROD-EASTUS2/providers/Microsoft.Compute/galleries/CeridianAppImageGallery/images/ubuntu2004-ado-agent/versions?api-version=2022-03-03
Headers:
Accept-Language : en-US
x-ms-client-request-id : 825ff512-5764-4435-8ff8-300ec4ba74db
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/ListGalleryImageVersionsInGalleryImage3Min;1498,Microsoft.Compute/ListGalleryImageVersionsInGalleryImage30Min;9956
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-served-by : f5a9e422-7cdc-4ee9-8efd-7f400c4a0f17_133180968507091114,f5a9e422-7cdc-4ee9-8efd-7f400c4a0f17_133180968507091114
x-ms-request-id : 4594ec7d-3db2-4165-8af1-b0aba825f2e3
Server : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11996
x-ms-correlation-request-id : 13eb8741-2d60-4822-8c41-bc247baaf4a9
x-ms-routing-request-id : GERMANYNORTH:20230310T125513Z:13eb8741-2d60-4822-8c41-bc247baaf4a9
X-Content-Type-Options : nosniff
Date : Fri, 10 Mar 2023 12:55:12 GMT
Body:
{
"value": [
{
"name": "2023.01.272239",
"id": "/subscriptions//resourceGroups/APP518-SIG-PROD-EASTUS2/providers/Microsoft.Compute/galleries/CeridianAppImageGallery/images/ubuntu2004-ado-agent/versions/2023.01.272239",
"type": "Microsoft.Compute/galleries/images/versions",
"location": "eastus2",
"tags": {
"creationdate": "20230127223904",
"creator": "ado",
"environment": "np",
"ostype": "linux",
"source": "packer",
"BillTo": "P&T"
},
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "East US 2",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS"
}
],
"replicaCount": 1,
"excludeFromLatest": false,
"publishedDate": "2023-01-27T23:48:40.3301357+01:00",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions//resourceGroups/a/providers/Microsoft.Compute/images/CERIDIAN-ubuntu2004-ceridian-adoagent-202301272239"
},
"osDiskImage": {
"sizeInGB": 30,
"hostCaching": "ReadWrite",
"source": {}
}
},
"safetyProfile": {
"reportedForPolicyViolation": false,
"allowDeletionOfReplicatedLocations": true
},
"provisioningState": "Succeeded"
}
}
]
}
DEBUG: AzureQoSEvent: Module: Az.Compute:5.4.0; CommandName: Get-AzGalleryImageVersion; PSVersion: 7.3.3; IsSuccess: True; Duration: 00:00:01.0198593
DEBUG: 1:55:13 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:13 PM - GetAzureRmGalleryImageVersion end processing.
1
I am here 2023.01.272239 of ubuntu2004-ado-agent
InvalidOperation: /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66:21
Line |
66 | … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.3.3
PSEdition Core
GitCommitId 7.3.3
OS Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.11.2 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 5.4.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
```
### Error output
```PowerShell
PS /Users/mariuszborys/azurerepos> Resolve-AzError
DEBUG: 1:57:59 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 1:57:59 PM - using account id ''...
DEBUG: 1:57:59 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: -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at lambda_method3151(Closure, Object[], StrongBox`1[], InterpretedFrame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at lambda_method3151(Closure, Object[], StrongBox`1[], InterpretedFrame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at lambda_method3151(Closure, Object[], StrongBox`1[], InterpretedFrame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:66 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:64 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:64 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:64 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:64 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:64 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
Message : Method invocation failed because [Microsoft.Azure.Commands.Compute.Automation.Models.PSGalleryImageVersionList] does not contain a method named 'indexof'.
StackTrace : at CallSite.Target(Closure, CallSite, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -and ($targetRegionCount -eq 8)) {
Position : At /Users/mariuszborys/azurerepos/scripts/azure_pwsh_tools_scripts/Image galery cleaner/RunbookTEST.ps1:64 char:21
+ … if (($AzGalDefImageVersions.indexof($ImageVersion) -eq 0) -an …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.11.2; CommandName: Resolve-AzError; PSVersion: 7.3.3; IsSuccess: True; Duration: 00:00:00.0216611
DEBUG: 1:57:59 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:57:59 PM - ResolveError end processing.
```
Contributor guide
Assessment
This issue has not been assessed yet.