Skip to content

Commit 5f524b1

Browse files
kairu-msCustardTart32
authored andcommitted
aaz: Add cross tenants control for AAZResourceIdArgFormat (Azure#30817)
1 parent d2c9160 commit 5f524b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/azure-cli-core/azure/cli/core/aaz/_arg_fmt.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -659,14 +659,16 @@ def __call__(self, ctx, data):
659659

660660
return data
661661

662-
def __init__(self, template=None):
662+
def __init__(self, template=None, cross_tenants=True):
663663
"""
664664
665665
:param template: template property is used to verify a resource Id or construct resource Id.
666+
:param cross_tenants: if cross_tenants is True, the resource id will apply to cross-tenants scenarios.
666667
"""
667668
self._template = None
668669
if template:
669670
self._template = self._Template(template)
671+
self._cross_tenants = cross_tenants
670672

671673
def __call__(self, ctx, value):
672674
from azure.mgmt.core.tools import parse_resource_id
@@ -682,7 +684,7 @@ def __call__(self, ctx, value):
682684

683685
parsed_id = parse_resource_id(data)
684686
subscription_id = parsed_id.get('subscription', None)
685-
if subscription_id:
687+
if subscription_id and self._cross_tenants:
686688
# update subscription_id to support cross tenants
687689
ctx.update_aux_subscriptions(subscription_id)
688690

0 commit comments

Comments
 (0)