Azure / Azure/azure-powershell
Get-AzMarketplaceTerms fails to retried terms
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
Get-AzMarketplaceTerms fails to retrieve terms for offers that have not been yet accepted (and therefore) they can´t be accepted through Posh.

az cli equivament works fine.

After accepted the powershell command runs fine:

### Issue script & Debug output
```PowerShell
PS /> Get-AzMarketplaceterms -Publisher "microsoft-ads" -Product "windows-data-science-vm" -Name "windows2022"
DEBUG: 12:20:59 p.m. - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/6c64f9ed-88d2-4598-8de6-7a9527dc16ca/providers/Microsoft.MarketplaceOrdering/agreements/microsoft-ads/offers/windows-data-science-vm/plans/windows2022?api-version=2021-01-01
DEBUG: RequestCreated: /subscriptions/6c64f9ed-88d2-4598-8de6-7a9527dc16ca/providers/Microsoft.MarketplaceOrdering/agreements/microsoft-ads/offers/windows-data-science-vm/plans/windows2022?api-version=2021-01-01
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/6c64f9ed-88d2-4598-8de6-7a9527dc16ca/providers/Microsoft.MarketplaceOrdering/agreements/microsoft-ads/offers/windows-data-science-vm/plans/windows2022?api-version=2021-01-01
Headers:
x-ms-unique-id : 17,18
x-ms-client-request-id : 90f067b3-1a1e-4419-a49a-5d1e68fc0d98
CommandName : Get-AzMarketplaceterms
FullCommandName : Get-AzMarketplaceTerms_Get1
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v2022.11.0,Az.MarketplaceOrdering/2.0.0
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Cache-Control : no-cache
Pragma : no-cache
X-Frame-Options : SAMEORIGIN
Server : Microsoft-IIS/10.0
X-Powered-By : ASP.NET
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-request-id : ea0652be-1729-49b6-9142-7d7958c5d51c
x-ms-correlation-request-id : ea0652be-1729-49b6-9142-7d7958c5d51c
x-ms-routing-request-id : CANADACENTRAL:20221214T172100Z:ea0652be-1729-49b6-9142-7d7958c5d51c
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Wed, 14 Dec 2022 17:21:00 GMT
Body:
{
"error": {
"code": "NotFound",
"message": "Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer = 'windows-data-science-vm', sku = 'windows2022', Correlation Id: 'ea0652be-1729-49b6-9142-7d7958c5d51c'."
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
WARNING: Get-AzMarketplaceTerms_Get1 is not found. The most similar Azure PowerShell command is:
Get-AzMarketplaceTerms
Get-AzMarketplaceTerms_Get1: /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537:9
Line |
537 | $steppablePipeline.Begin($PSCmdlet)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer = 'windows-data-science-vm', sku =
| 'windows2022', Correlation Id: 'ea0652be-1729-49b6-9142-7d7958c5d51c'.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSResourceNotFoundCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.MarketplaceOrdering:2.0.0; CommandName: Get-AzMarketplaceTerms; PSVersion: 2022.11.0; IsSuccess: False; Duration: 00:00:01.4368451; Exception: InternalException;
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Linux 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022
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.10.3 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 2.0.0 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Invoke-AzMarketplaceSignTerms, Set-AzMarketpla…
```
### Error output
```PowerShell
PS /> Resolve-AzError
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 12:22:15 p.m. - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 12:22:15 p.m. - using account id 'jose@fehse.ca'...
DEBUG: 12:22:15 p.m. - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
HistoryId: 22
Message : [NotFound] : Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer =
'windows-data-science-vm', sku = 'windows2022', Correlation Id: 'ea0652be-1729-49b6-9142-7d7958c5d51c'.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzMarketplaceTerms_Get1}
Line : $steppablePipeline.Begin($PSCmdlet)
Position : At /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537 char:9
+ $steppablePipeline.Begin($PSCmdlet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 22
HistoryId: -1
Message : Unable to find type [image].
StackTrace : at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)
at System.Management.Automation.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : 
Position : At line:1 char:3
+ 
Position : At /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537 char:9
+ $steppablePipeline.Begin($PSCmdlet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 16
HistoryId: 14
Message : [NotFound] : Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer =
'windows-data-science-vm', sku = 'windows2019', Correlation Id: '40c2adfe-aef3-4436-86ab-5516a3c915af'.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzMarketplaceTerms_Get1}
Line : $steppablePipeline.Begin($PSCmdlet)
Position : At /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537 char:9
+ $steppablePipeline.Begin($PSCmdlet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 14
HistoryId: 12
Message : [NotFound] : Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer =
'windows-data-science-vm', sku = 'windows2019', Correlation Id: 'd94fbaf2-9e06-4bc0-b2db-3be8cc20dbff'.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzMarketplaceTerms_Get1}
Line : $steppablePipeline.Begin($PSCmdlet)
Position : At /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537 char:9
+ $steppablePipeline.Begin($PSCmdlet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 12
HistoryId: 3
Message : [NotFound] : Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer =
'windows-data-science-vm', sku = 'windows2016', Correlation Id: 'd47c50a4-be01-4d2f-b9a2-2ec0714d4afb'.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzMarketplaceTerms_Get1}
Line : $steppablePipeline.Begin($PSCmdlet)
Position : At /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537 char:9
+ $steppablePipeline.Begin($PSCmdlet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3
HistoryId: 1
Message : [NotFound] : Unable to find legal terms for this offer. Agreement has never been signed for this offer. offer =
'windows-data-science-vm', sku = 'windows2016', Correlation Id: '16e9361f-ecd6-410e-9d13-9ab30363fe43'.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzMarketplaceTerms_Get1}
Line : $steppablePipeline.Begin($PSCmdlet)
Position : At /home/jofehse/.local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537 char:9
+ $steppablePipeline.Begin($PSCmdlet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 1
The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
DEBUG: 12:22:15 p.m. - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.10.3; CommandName: Resolve-AzError; PSVersion: 7.3.0; IsSuccess: True; Duration: 00:00:00.0884836
DEBUG: 12:22:15 p.m. - ResolveError end processing.
```
Contributor guide
Assessment
This issue has not been assessed yet.