diff --git a/doc/sphinx/azhelpgen/doc_source_map.json b/doc/sphinx/azhelpgen/doc_source_map.json
index 8b713dee799..d3113dbae16 100644
--- a/doc/sphinx/azhelpgen/doc_source_map.json
+++ b/doc/sphinx/azhelpgen/doc_source_map.json
@@ -75,5 +75,6 @@
"aro": "src/azure-cli/azure/cli/command_modules/aro/_help.py",
"util": "src/azure-cli/azure/cli/command_modules/util/_help.py",
"synapse": "src/azure-cli/azure/cli/command_modules/synapse/_help.py",
- "databoxedge": "src/azure-cli/azure/cli/command_modules/databoxedge/_help.py"
+ "databoxedge": "src/azure-cli/azure/cli/command_modules/databoxedge/_help.py",
+ "term": "src/azure-cli/azure/cli/command_modules/marketplaceordering/_help.py"
}
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/__init__.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/__init__.py
new file mode 100644
index 00000000000..671dbcb7900
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/__init__.py
@@ -0,0 +1,52 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+from azure.cli.core import AzCommandsLoader
+import azure.cli.command_modules.marketplaceordering._help # pylint: disable=unused-import
+
+
+class MarketplaceOrderingAgreementsCommandsLoader(AzCommandsLoader):
+
+ def __init__(self, cli_ctx=None):
+ from azure.cli.core.commands import CliCommandType
+ from .generated._client_factory import cf_marketplaceordering_cl
+ marketplaceordering_custom = CliCommandType(
+ operations_tmpl='azure.cli.command_modules.marketplaceordering.custom#{}',
+ client_factory=cf_marketplaceordering_cl)
+ parent = super(MarketplaceOrderingAgreementsCommandsLoader, self)
+ parent.__init__(cli_ctx=cli_ctx, custom_command_type=marketplaceordering_custom)
+
+ def load_command_table(self, args):
+ from .generated.commands import load_command_table
+ load_command_table(self, args)
+ try:
+ from .manual.commands import load_command_table as load_command_table_manual
+ load_command_table_manual(self, args)
+ except ImportError as e:
+ if e.name.endswith('manual.commands'):
+ pass
+ else:
+ raise e
+ return self.command_table
+
+ def load_arguments(self, command):
+ from .generated._params import load_arguments
+ load_arguments(self, command)
+ try:
+ from .manual._params import load_arguments as load_arguments_manual
+ load_arguments_manual(self, command)
+ except ImportError as e:
+ if e.name.endswith('manual._params'):
+ pass
+ else:
+ raise e
+
+
+COMMAND_LOADER_CLS = MarketplaceOrderingAgreementsCommandsLoader
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/_help.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/_help.py
new file mode 100644
index 00000000000..d0322a6f3f0
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/_help.py
@@ -0,0 +1,20 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=wildcard-import
+# pylint: disable=unused-wildcard-import
+
+from .generated._help import helps # pylint: disable=unused-import, disable=reimported
+try:
+ from .manual._help import helps # pylint: disable=reimported
+except ImportError as e:
+ if e.name.endswith('manual._help'):
+ pass
+ else:
+ raise e
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/action.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/action.py
new file mode 100644
index 00000000000..9b3d0a8a78c
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/action.py
@@ -0,0 +1,20 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=wildcard-import
+# pylint: disable=unused-wildcard-import
+
+from .generated.action import * # noqa: F403
+try:
+ from .manual.action import * # noqa: F403
+except ImportError as e:
+ if e.name.endswith('manual.action'):
+ pass
+ else:
+ raise e
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/custom.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/custom.py
new file mode 100644
index 00000000000..885447229d6
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/custom.py
@@ -0,0 +1,20 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=wildcard-import
+# pylint: disable=unused-wildcard-import
+
+from .generated.custom import * # noqa: F403
+try:
+ from .manual.custom import * # noqa: F403
+except ImportError as e:
+ if e.name.endswith('manual.custom'):
+ pass
+ else:
+ raise e
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/__init__.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/__init__.py
new file mode 100644
index 00000000000..c9cfdc73e77
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/__init__.py
@@ -0,0 +1,12 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_client_factory.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_client_factory.py
new file mode 100644
index 00000000000..4a1ca6a6d2e
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_client_factory.py
@@ -0,0 +1,20 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+
+def cf_marketplaceordering_cl(cli_ctx, *_):
+ from azure.cli.core.commands.client_factory import get_mgmt_service_client
+ from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements
+ return get_mgmt_service_client(cli_ctx,
+ MarketplaceOrderingAgreements)
+
+
+def cf_marketplace_agreement(cli_ctx, *_):
+ return cf_marketplaceordering_cl(cli_ctx).marketplace_agreements
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_help.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_help.py
new file mode 100644
index 00000000000..c50a6bd626c
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_help.py
@@ -0,0 +1,36 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=too-many-lines
+
+from knack.help_files import helps
+
+
+helps['term'] = """
+ type: group
+ short-summary: Manage marketplace agreement with marketplaceordering
+"""
+
+helps['term show'] = """
+ type: command
+ short-summary: "Get marketplace terms."
+ examples:
+ - name: GetMarketplaceTerms
+ text: |-
+ az term show --product "offid" --plan "planid" --publisher "pubid"
+"""
+
+helps['term accept'] = """
+ type: command
+ short-summary: "Accept marketplace terms."
+ examples:
+ - name: SetMarketplaceTerms
+ text: |-
+ az term accept --product "offid" --plan "planid" --publisher "pubid"
+"""
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_params.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_params.py
new file mode 100644
index 00000000000..94e4d56265b
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_params.py
@@ -0,0 +1,24 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=too-many-lines
+# pylint: disable=too-many-statements
+
+
+def load_arguments(self, _):
+
+ with self.argument_context('term show') as c:
+ c.argument('publisher', type=str, help='Publisher identifier string of image being deployed.')
+ c.argument('product', type=str, help='Offeridentifier string of image being deployed.')
+ c.argument('plan', type=str, help='Plan identifier string of image being deployed.')
+
+ with self.argument_context('term accept') as c:
+ c.argument('publisher', type=str, help='Publisher identifier string of image being deployed.')
+ c.argument('product', type=str, help='Offer identifier string of image being deployed.')
+ c.argument('plan', type=str, help='Plan identifier string of image being deployed.')
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_validators.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_validators.py
new file mode 100644
index 00000000000..b33a44c1ebf
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_validators.py
@@ -0,0 +1,9 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/action.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/action.py
new file mode 100644
index 00000000000..b49bfaeeefe
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/action.py
@@ -0,0 +1,10 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=protected-access
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/commands.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/commands.py
new file mode 100644
index 00000000000..b7f993154e5
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/commands.py
@@ -0,0 +1,31 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=too-many-statements
+# pylint: disable=too-many-locals
+# pylint: disable=bad-continuation
+# pylint: disable=line-too-long
+
+from azure.cli.core.commands import CliCommandType
+from ..generated._client_factory import cf_marketplace_agreement
+
+
+marketplaceordering_marketplace_agreement = CliCommandType(
+ operations_tmpl='azure.mgmt.marketplaceordering.operations._marketplace_agreements_operations#MarketplaceAgreementsOperations.{}',
+ client_factory=cf_marketplace_agreement,
+)
+
+
+def load_command_table(self, _):
+
+ with self.command_group(
+ 'term', marketplaceordering_marketplace_agreement, client_factory=cf_marketplace_agreement, is_experimental=True
+ ) as g:
+ g.custom_show_command('show', 'term_show')
+ g.custom_command('accept', 'term_accept')
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/custom.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/custom.py
new file mode 100644
index 00000000000..bbea0c8010b
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/custom.py
@@ -0,0 +1,20 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=too-many-lines
+
+
+def term_show(client,
+ publisher,
+ product,
+ plan):
+ return client.get(offer_type="virtualmachine",
+ publisher_id=publisher,
+ offer_id=product,
+ plan_id=plan)
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/__init__.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/__init__.py
new file mode 100644
index 00000000000..c9cfdc73e77
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/__init__.py
@@ -0,0 +1,12 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/_help.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/_help.py
new file mode 100644
index 00000000000..2117c6a360e
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/_help.py
@@ -0,0 +1,36 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=too-many-lines
+
+from knack.help_files import helps
+
+
+helps['term'] = """
+ type: group
+ short-summary: Manage marketplace agreement with marketplaceordering
+"""
+
+helps['term show'] = """
+ type: command
+ short-summary: "Get marketplace terms."
+ examples:
+ - name: Get marketeplace terms.
+ text: |-
+ az term show --product "windows-data-science-vm" --plan "windows2016" --publisher "microsoft-ads"
+"""
+
+helps['term accept'] = """
+ type: command
+ short-summary: "Accept marketplace terms."
+ examples:
+ - name: Set marketplace terms.
+ text: |-
+ az term accept --product "windows-data-science-vm" --plan "windows2016" --publisher "microsoft-ads"
+"""
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/custom.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/custom.py
new file mode 100644
index 00000000000..c3d4d03fbbc
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/custom.py
@@ -0,0 +1,39 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=too-many-lines
+
+
+def term_accept(client,
+ publisher,
+ product,
+ plan):
+ offerDetail = client.get(offer_type="virtualmachine",
+ publisher_id=publisher,
+ offer_id=product,
+ plan_id=plan)
+ if offerDetail is None:
+ from azure.cli.core.azclierror import ValidationError
+ raise ValidationError(
+ 'cannot find offer with publisher {}, product {} and plan {}.'.format(publisher, product, plan))
+ parameters = {}
+ parameters['publisher'] = publisher
+ parameters['product'] = product
+ parameters['plan'] = plan
+ parameters['license_text_link'] = offerDetail.license_text_link
+ parameters['privacy_policy_link'] = offerDetail.privacy_policy_link
+ parameters['marketplace_terms_link'] = offerDetail.marketplace_terms_link
+ parameters['retrieve_datetime'] = offerDetail.retrieve_datetime
+ parameters['signature'] = offerDetail.signature
+ parameters['accepted'] = True
+ return client.create(offer_type="virtualmachine",
+ publisher_id=publisher,
+ offer_id=product,
+ plan_id=plan,
+ parameters=parameters)
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/report.md b/src/azure-cli/azure/cli/command_modules/marketplaceordering/report.md
new file mode 100644
index 00000000000..775e0133b37
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/report.md
@@ -0,0 +1,52 @@
+# Azure CLI Module Creation Report
+
+## EXTENSION
+|CLI Extension|Command Groups|
+|---------|------------|
+|az marketplaceordering|[groups](#CommandGroups)
+
+## GROUPS
+### Command groups in `az marketplaceordering` extension
+|CLI Command Group|Group Swagger name|Commands|
+|---------|------------|--------|
+|az term|MarketplaceAgreements|[commands](#CommandsInMarketplaceAgreements)|
+
+## COMMANDS
+### Commands in `az term` group
+|CLI Command|Operation Swagger name|Parameters|Examples|
+|---------|------------|--------|-----------|
+|[az term show](#MarketplaceAgreementsGet)|Get|[Parameters](#ParametersMarketplaceAgreementsGet)|[Example](#ExamplesMarketplaceAgreementsGet)|
+|[az term accept](#MarketplaceAgreementsCreate)|Create|[Parameters](#ParametersMarketplaceAgreementsCreate)|[Example](#ExamplesMarketplaceAgreementsCreate)|
+
+
+## COMMAND DETAILS
+
+### group `az term`
+#### Command `az term show`
+
+##### Example
+```
+az term show --offer "offid" --plan "planid" --publisher "pubid"
+```
+##### Parameters
+|Option|Type|Description|Path (SDK)|Swagger name|
+|------|----|-----------|----------|------------|
+|**--publisher**|string|Publisher identifier string of image being deployed.|publisher|publisherId|
+|**--offer**|string|Offer identifier string of image being deployed.|offer|offerId|
+|**--plan**|string|Plan identifier string of image being deployed.|plan|planId|
+
+#### Command `az term accept`
+
+##### Example
+```
+az term accept --offer "offid" --plan "planid" --offer "offid" --publisher "pubid" --plan "planid" --publisher "pubid"
+```
+##### Parameters
+|Option|Type|Description|Path (SDK)|Swagger name|
+|------|----|-----------|----------|------------|
+|**--publisher**|string|Publisher identifier string of image being deployed.|publisher|publisherId|
+|**--offer**|string|Offer identifier string of image being deployed.|offer|offerId|
+|**--plan**|string|Plan identifier string of image being deployed.|plan|planId|
+|**--publisher**|string|Publisher identifier string of image being deployed.|publisher|publisher|
+|**--offer**|string|Offer identifier string of image being deployed.|offer|product|
+|**--plan**|string|Plan identifier string of image being deployed.|plan|plan|
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/__init__.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/__init__.py
new file mode 100644
index 00000000000..70488e93851
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/__init__.py
@@ -0,0 +1,116 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+import inspect
+import logging
+import os
+import sys
+import traceback
+import datetime as dt
+
+from azure.core.exceptions import AzureError
+from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError
+
+
+logger = logging.getLogger('azure.cli.testsdk')
+logger.addHandler(logging.StreamHandler())
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)
+exceptions = []
+test_map = dict()
+SUCCESSED = "successed"
+FAILED = "failed"
+
+
+def try_manual(func):
+ def import_manual_function(origin_func):
+ from importlib import import_module
+ decorated_path = inspect.getfile(origin_func).lower()
+ module_path = __path__[0].lower()
+ if not decorated_path.startswith(module_path):
+ raise Exception("Decorator can only be used in submodules!")
+ manual_path = os.path.join(
+ decorated_path[module_path.rfind(os.path.sep) + 1:])
+ manual_file_path, manual_file_name = os.path.split(manual_path)
+ module_name, _ = os.path.splitext(manual_file_name)
+ manual_module = "..manual." + \
+ ".".join(manual_file_path.split(os.path.sep) + [module_name, ])
+ return getattr(import_module(manual_module, package=__name__), origin_func.__name__)
+
+ def get_func_to_call():
+ func_to_call = func
+ try:
+ func_to_call = import_manual_function(func)
+ logger.info("Found manual override for %s(...)", func.__name__)
+ except (ImportError, AttributeError):
+ pass
+ return func_to_call
+
+ def wrapper(*args, **kwargs):
+ func_to_call = get_func_to_call()
+ logger.info("running %s()...", func.__name__)
+ try:
+ test_map[func.__name__] = dict()
+ test_map[func.__name__]["result"] = SUCCESSED
+ test_map[func.__name__]["error_message"] = ""
+ test_map[func.__name__]["error_stack"] = ""
+ test_map[func.__name__]["error_normalized"] = ""
+ test_map[func.__name__]["start_dt"] = dt.datetime.utcnow()
+ ret = func_to_call(*args, **kwargs)
+ except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit,
+ JMESPathCheckAssertionError) as e:
+ use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE")
+ if use_exception_cache is None or use_exception_cache.lower() != "true":
+ raise
+ test_map[func.__name__]["end_dt"] = dt.datetime.utcnow()
+ test_map[func.__name__]["result"] = FAILED
+ test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500]
+ test_map[func.__name__]["error_stack"] = traceback.format_exc().replace(
+ "\r\n", " ").replace("\n", " ")[:500]
+ logger.info("--------------------------------------")
+ logger.info("step exception: %s", e)
+ logger.error("--------------------------------------")
+ logger.error("step exception in %s: %s", func.__name__, e)
+ logger.info(traceback.format_exc())
+ exceptions.append((func.__name__, sys.exc_info()))
+ else:
+ test_map[func.__name__]["end_dt"] = dt.datetime.utcnow()
+ return ret
+
+ if inspect.isclass(func):
+ return get_func_to_call()
+ return wrapper
+
+
+def calc_coverage(filename):
+ filename = filename.split(".")[0]
+ coverage_name = filename + "_coverage.md"
+ with open(coverage_name, "w") as f:
+ f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n")
+ total = len(test_map)
+ covered = 0
+ for k, v in test_map.items():
+ if not k.startswith("step_"):
+ total -= 1
+ continue
+ if v["result"] == SUCCESSED:
+ covered += 1
+ f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|"
+ "{end_dt}|\n".format(step_name=k, **v))
+ f.write("Coverage: {}/{}\n".format(covered, total))
+ print("Create coverage\n", file=sys.stderr)
+
+
+def raise_if():
+ if exceptions:
+ if len(exceptions) <= 1:
+ raise exceptions[0][1][1]
+ message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1]))
+ message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]])
+ raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2])
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/__init__.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/__init__.py
new file mode 100644
index 00000000000..c9cfdc73e77
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/__init__.py
@@ -0,0 +1,12 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/example_steps.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/example_steps.py
new file mode 100644
index 00000000000..4fe209fa9ae
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/example_steps.py
@@ -0,0 +1,44 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+
+from .. import try_manual
+
+
+# EXAMPLE: /MarketplaceAgreements/put/SetMarketplaceTerms
+@try_manual
+def step_accept(test, checks=None):
+ if checks is None:
+ checks = []
+ test.cmd('az term accept '
+ '--product "vsec" '
+ '--plan "management" '
+ '--publisher "checkpoint"',
+ checks=[
+ test.check('plan', 'management'),
+ test.check('publisher', 'checkpoint'),
+ test.check('product', 'vsec'),
+ ])
+
+
+# EXAMPLE: /MarketplaceAgreements/get/GetMarketplaceTerms
+@try_manual
+def step_show(test, checks=None):
+ if checks is None:
+ checks = []
+ test.cmd('az term show '
+ '--product "vsec" '
+ '--plan "management" '
+ '--publisher "checkpoint"',
+ checks=[
+ test.check('plan', 'management'),
+ test.check('publisher', 'checkpoint'),
+ test.check('product', 'vsec'),
+ ])
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/recordings/test_marketplaceordering_Scenario.yaml b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/recordings/test_marketplaceordering_Scenario.yaml
new file mode 100644
index 00000000000..7ee4139e276
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/recordings/test_marketplaceordering_Scenario.yaml
@@ -0,0 +1,166 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/json
+ Accept-Encoding:
+ - gzip, deflate
+ CommandName:
+ - term accept
+ Connection:
+ - keep-alive
+ ParameterSetName:
+ - --product --plan --publisher
+ User-Agent:
+ - AZURECLI/2.22.1 azsdk-python-mgmt-marketplaceordering/1.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MarketplaceOrdering/offerTypes/virtualmachine/publishers/checkpoint/offers/vsec/plans/management/agreements/current?api-version=2021-01-01
+ response:
+ body:
+ string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MarketplaceOrdering/offerTypes/VirtualMachine/publishers/checkpoint/offers/vsec/plans/management/agreements/current","name":"management","type":"Microsoft.MarketplaceOrdering/offertypes","properties":{"publisher":"checkpoint","product":"vsec","plan":"management","licenseTextLink":"https://mpcprodsa.blob.core.windows.net/legalterms/3E5ED_legalterms_CHECKPOINT%253a24VSEC%253a24MANAGEMENT%253a2476HGNZSJREVLUQYE5WCZFRGIHF7HY2INZQW36Z5VLZ34BDJPP7742LAWDYIF7LIYDIM6RP55RIPRVIMZEOQWM6JL7YU7AD32MLUPYWY.txt","privacyPolicyLink":"http://www.checkpoint.com/privacy","marketplaceTermsLink":"https://mpcprodsa.blob.core.windows.net/marketplaceterms/3EDEF_marketplaceterms_AZUREAPPLICATION%253a24OF7TIMHFEMPZHRBYEO3SVLC7Q2MPXXAASJ5BO2FUY4UC6EZCN5TIL2KIGTA7WI2CSM3WV4L7QMPNRYPE2I7BOCM34RGOL3XTC6ADIMI.txt","retrieveDatetime":"2021-04-25T06:26:56.5846529Z","signature":"S62ZWHFPI252EPBYJDAKIVPZHEPB7J74H573N2PQY3NMSVHTI7DXTNWB45BU3IYAR3OQQBPIC37XJWWLLRJN3MZMPLGWB45HRW5ORDY","accepted":true},"systemData":{"createdBy":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","createdByType":"ManagedIdentity","createdAt":"2021-04-25T06:26:56.6546848+00:00","lastModifiedBy":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","lastModifiedByType":"ManagedIdentity","lastModifiedAt":"2021-04-25T06:26:56.6546848+00:00"}}'
+ headers:
+ cache-control:
+ - no-cache
+ content-length:
+ - '1356'
+ content-type:
+ - application/json; charset=utf-8
+ date:
+ - Sun, 25 Apr 2021 06:26:56 GMT
+ expires:
+ - '-1'
+ pragma:
+ - no-cache
+ server:
+ - Microsoft-IIS/10.0
+ set-cookie:
+ - ARRAffinity=58ceea6a1792f273fe5e5e5f83f4313f8115bf7624e6e9d034520f280f67842d;Path=/;HttpOnly;Secure;Domain=storeapi.azure.com
+ - ARRAffinitySameSite=58ceea6a1792f273fe5e5e5f83f4313f8115bf7624e6e9d034520f280f67842d;Path=/;HttpOnly;SameSite=None;Secure;Domain=storeapi.azure.com
+ strict-transport-security:
+ - max-age=31536000; includeSubDomains
+ transfer-encoding:
+ - chunked
+ vary:
+ - Accept-Encoding,Accept-Encoding
+ x-content-type-options:
+ - nosniff
+ x-powered-by:
+ - ASP.NET
+ status:
+ code: 200
+ message: OK
+- request:
+ body: '{"properties": {"publisher": "checkpoint", "product": "vsec", "plan": "management",
+ "licenseTextLink": "https://mpcprodsa.blob.core.windows.net/legalterms/3E5ED_legalterms_CHECKPOINT%253a24VSEC%253a24MANAGEMENT%253a2476HGNZSJREVLUQYE5WCZFRGIHF7HY2INZQW36Z5VLZ34BDJPP7742LAWDYIF7LIYDIM6RP55RIPRVIMZEOQWM6JL7YU7AD32MLUPYWY.txt",
+ "privacyPolicyLink": "http://www.checkpoint.com/privacy", "marketplaceTermsLink":
+ "https://mpcprodsa.blob.core.windows.net/marketplaceterms/3EDEF_marketplaceterms_AZUREAPPLICATION%253a24OF7TIMHFEMPZHRBYEO3SVLC7Q2MPXXAASJ5BO2FUY4UC6EZCN5TIL2KIGTA7WI2CSM3WV4L7QMPNRYPE2I7BOCM34RGOL3XTC6ADIMI.txt",
+ "retrieveDatetime": "2021-04-25T06:26:56.5846529Z", "signature": "S62ZWHFPI252EPBYJDAKIVPZHEPB7J74H573N2PQY3NMSVHTI7DXTNWB45BU3IYAR3OQQBPIC37XJWWLLRJN3MZMPLGWB45HRW5ORDY",
+ "accepted": true}}'
+ headers:
+ Accept:
+ - application/json
+ Accept-Encoding:
+ - gzip, deflate
+ CommandName:
+ - term accept
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '813'
+ Content-Type:
+ - application/json
+ ParameterSetName:
+ - --product --plan --publisher
+ User-Agent:
+ - AZURECLI/2.22.1 azsdk-python-mgmt-marketplaceordering/1.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
+ method: PUT
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MarketplaceOrdering/offerTypes/virtualmachine/publishers/checkpoint/offers/vsec/plans/management/agreements/current?api-version=2021-01-01
+ response:
+ body:
+ string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MarketplaceOrdering/offerTypes/Microsoft.MarketplaceOrdering/offertypes/publishers/checkpoint/offers/vsec/plans/management/agreements/current","name":"management","type":"Microsoft.MarketplaceOrdering/offertypes","properties":{"publisher":"checkpoint","product":"vsec","plan":"management","licenseTextLink":"https://mpcprodsa.blob.core.windows.net/legalterms/3E5ED_legalterms_CHECKPOINT%253a24VSEC%253a24MANAGEMENT%253a2476HGNZSJREVLUQYE5WCZFRGIHF7HY2INZQW36Z5VLZ34BDJPP7742LAWDYIF7LIYDIM6RP55RIPRVIMZEOQWM6JL7YU7AD32MLUPYWY.txt","privacyPolicyLink":"http://www.checkpoint.com/privacy","marketplaceTermsLink":"https://mpcprodsa.blob.core.windows.net/marketplaceterms/3EDEF_marketplaceterms_AZUREAPPLICATION%253a24OF7TIMHFEMPZHRBYEO3SVLC7Q2MPXXAASJ5BO2FUY4UC6EZCN5TIL2KIGTA7WI2CSM3WV4L7QMPNRYPE2I7BOCM34RGOL3XTC6ADIMI.txt","retrieveDatetime":"2021-04-25T06:26:56.5846529Z","signature":"S62ZWHFPI252EPBYJDAKIVPZHEPB7J74H573N2PQY3NMSVHTI7DXTNWB45BU3IYAR3OQQBPIC37XJWWLLRJN3MZMPLGWB45HRW5ORDY","accepted":true},"systemData":{"createdBy":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","createdByType":"ManagedIdentity","createdAt":"2021-04-25T06:26:59.5419831+00:00","lastModifiedBy":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","lastModifiedByType":"ManagedIdentity","lastModifiedAt":"2021-04-25T06:26:59.5419831+00:00"}}'
+ headers:
+ cache-control:
+ - no-cache
+ content-length:
+ - '1382'
+ content-type:
+ - application/json; charset=utf-8
+ date:
+ - Sun, 25 Apr 2021 06:26:59 GMT
+ expires:
+ - '-1'
+ pragma:
+ - no-cache
+ server:
+ - Microsoft-IIS/10.0
+ set-cookie:
+ - ARRAffinity=0167904c093642b6eb1372d43ab24808f2271061b5c98f5a81aaceaaff5f0ca1;Path=/;HttpOnly;Secure;Domain=storeapi.azure.com
+ - ARRAffinitySameSite=0167904c093642b6eb1372d43ab24808f2271061b5c98f5a81aaceaaff5f0ca1;Path=/;HttpOnly;SameSite=None;Secure;Domain=storeapi.azure.com
+ strict-transport-security:
+ - max-age=31536000; includeSubDomains
+ transfer-encoding:
+ - chunked
+ vary:
+ - Accept-Encoding,Accept-Encoding
+ x-content-type-options:
+ - nosniff
+ x-ms-ratelimit-remaining-subscription-writes:
+ - '1199'
+ x-powered-by:
+ - ASP.NET
+ status:
+ code: 200
+ message: OK
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/json
+ Accept-Encoding:
+ - gzip, deflate
+ CommandName:
+ - term show
+ Connection:
+ - keep-alive
+ ParameterSetName:
+ - --product --plan --publisher
+ User-Agent:
+ - AZURECLI/2.22.1 azsdk-python-mgmt-marketplaceordering/1.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MarketplaceOrdering/offerTypes/virtualmachine/publishers/checkpoint/offers/vsec/plans/management/agreements/current?api-version=2021-01-01
+ response:
+ body:
+ string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MarketplaceOrdering/offerTypes/VirtualMachine/publishers/checkpoint/offers/vsec/plans/management/agreements/current","name":"management","type":"Microsoft.MarketplaceOrdering/offertypes","properties":{"publisher":"checkpoint","product":"vsec","plan":"management","licenseTextLink":"https://mpcprodsa.blob.core.windows.net/legalterms/3E5ED_legalterms_CHECKPOINT%253a24VSEC%253a24MANAGEMENT%253a2476HGNZSJREVLUQYE5WCZFRGIHF7HY2INZQW36Z5VLZ34BDJPP7742LAWDYIF7LIYDIM6RP55RIPRVIMZEOQWM6JL7YU7AD32MLUPYWY.txt","privacyPolicyLink":"http://www.checkpoint.com/privacy","marketplaceTermsLink":"https://mpcprodsa.blob.core.windows.net/marketplaceterms/3EDEF_marketplaceterms_AZUREAPPLICATION%253a24OF7TIMHFEMPZHRBYEO3SVLC7Q2MPXXAASJ5BO2FUY4UC6EZCN5TIL2KIGTA7WI2CSM3WV4L7QMPNRYPE2I7BOCM34RGOL3XTC6ADIMI.txt","retrieveDatetime":"2021-04-25T06:27:03.6775882Z","signature":"6HKM2SMH65MWTUS2JXXK6UEFY4S5AYYUI2ZPZJRD5SZH6K6MN4EKRMTAEKZOVAHF342EHCIGVKHPOR5HVA2INXQJ3TBPXUMEOII666I","accepted":true},"systemData":{"createdBy":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","createdByType":"ManagedIdentity","createdAt":"2021-04-25T06:27:03.7561884+00:00","lastModifiedBy":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","lastModifiedByType":"ManagedIdentity","lastModifiedAt":"2021-04-25T06:27:03.7561884+00:00"}}'
+ headers:
+ cache-control:
+ - no-cache
+ content-length:
+ - '1356'
+ content-type:
+ - application/json; charset=utf-8
+ date:
+ - Sun, 25 Apr 2021 06:27:03 GMT
+ expires:
+ - '-1'
+ pragma:
+ - no-cache
+ server:
+ - Microsoft-IIS/10.0
+ set-cookie:
+ - ARRAffinity=92773f2c1c67026ec4d9126bfcf778845d6357a27b8781ad374bcfa850a3111a;Path=/;HttpOnly;Secure;Domain=storeapi.azure.com
+ - ARRAffinitySameSite=92773f2c1c67026ec4d9126bfcf778845d6357a27b8781ad374bcfa850a3111a;Path=/;HttpOnly;SameSite=None;Secure;Domain=storeapi.azure.com
+ strict-transport-security:
+ - max-age=31536000; includeSubDomains
+ transfer-encoding:
+ - chunked
+ vary:
+ - Accept-Encoding,Accept-Encoding
+ x-content-type-options:
+ - nosniff
+ x-powered-by:
+ - ASP.NET
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/test_marketplaceordering_scenario.py b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/test_marketplaceordering_scenario.py
new file mode 100644
index 00000000000..4910f963dc2
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/test_marketplaceordering_scenario.py
@@ -0,0 +1,55 @@
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is
+# regenerated.
+# --------------------------------------------------------------------------
+
+import os
+from azure.cli.testsdk import ScenarioTest
+from .example_steps import step_accept
+from .example_steps import step_show
+from .. import (
+ try_manual,
+ raise_if,
+ calc_coverage
+)
+
+
+TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
+
+
+# Env setup_scenario
+@try_manual
+def setup_scenario(test):
+ pass
+
+
+# Env cleanup_scenario
+@try_manual
+def cleanup_scenario(test):
+ pass
+
+
+# Testcase: Scenario
+@try_manual
+def call_scenario(test):
+ setup_scenario(test)
+ step_accept(test, checks=[])
+ step_show(test, checks=[])
+ cleanup_scenario(test)
+
+
+# Test class for Scenario
+@try_manual
+class MarketplaceorderingScenarioTest(ScenarioTest):
+ def __init__(self, *args, **kwargs):
+ super(MarketplaceorderingScenarioTest, self).__init__(*args, **kwargs)
+
+ def test_marketplaceordering_Scenario(self):
+ call_scenario(self)
+ calc_coverage(__file__)
+ raise_if()
diff --git a/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/test_marketplaceordering_scenario_coverage.md b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/test_marketplaceordering_scenario_coverage.md
new file mode 100644
index 00000000000..29e2c024229
--- /dev/null
+++ b/src/azure-cli/azure/cli/command_modules/marketplaceordering/tests/latest/test_marketplaceordering_scenario_coverage.md
@@ -0,0 +1,4 @@
+|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|
+|step_accept|successed||||2021-04-25 06:27:15.466708|2021-04-25 06:27:15.643912|
+|step_show|successed||||2021-04-25 06:27:15.643912|2021-04-25 06:27:15.701910|
+Coverage: 2/2
diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json
index cc4728aa5a8..dccc15abc26 100644
--- a/src/azure-cli/service_name.json
+++ b/src/azure-cli/service_name.json
@@ -484,6 +484,11 @@
"AzureServiceName": "Azure Resource Manager",
"URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/tag-resources"
},
+ {
+ "Command": "az term",
+ "AzureServiceName": "Azure Marketplace Ordering",
+ "URL": "https://docs.microsoft.com/en-us/rest/api/marketplaceordering/"
+ },
{
"Command": "az ts",
"AzureServiceName": "Azure Resource Manager",