Skip to content

Commit e8efb79

Browse files
authored
[Role] az ad sp create-for-rbac: Add alias --json-auth for --sdk-auth (#26572)
* Add alias `--json-auth` for `--sdk-auth` of `az ad sp create-for-rbac` * update help information * remove the url
1 parent 7d3fdec commit e8efb79

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/azure-cli-core/azure/cli/core/_profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ def refresh_accounts(self):
640640
self._set_subscriptions(result, merge=False)
641641

642642
def get_sp_auth_info(self, subscription_id=None, name=None, password=None, cert_file=None):
643-
"""Generate a JSON for --sdk-auth argument when used in:
644-
- az ad sp create-for-rbac --sdk-auth
643+
"""Generate a JSON for --json-auth argument when used in:
644+
- az ad sp create-for-rbac --json-auth
645645
"""
646646
from collections import OrderedDict
647647
account = self.get_subscription(subscription_id)

src/azure-cli/azure/cli/command_modules/role/_params.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@ def load_arguments(self, _):
179179
help='Role of the service principal.')
180180
c.argument('skip_assignment', arg_type=get_three_state_flag(),
181181
deprecate_info=c.deprecate(target='--skip-assignment', hide=True), help='No-op.')
182-
c.argument('show_auth_for_sdk', options_list='--sdk-auth', deprecate_info=c.deprecate(target='--sdk-auth'),
183-
help='output result in compatible with Azure SDK auth file', arg_type=get_three_state_flag())
182+
c.argument('show_auth_in_json', options_list=['--sdk-auth', '--json-auth'],
183+
deprecate_info=c.deprecate(target='--sdk-auth'),
184+
help='Output service principal credential along with cloud endpoints in JSON format. ',
185+
arg_type=get_three_state_flag())
184186

185187
with self.argument_context('ad sp owner list') as c:
186188
c.argument('identifier', options_list=['--id'], help='service principal name, or object id or the service principal')

src/azure-cli/azure/cli/command_modules/role/custom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ def list_service_principal_owners(client, identifier):
11571157
def create_service_principal_for_rbac(
11581158
# pylint:disable=too-many-statements,too-many-locals, too-many-branches, unused-argument
11591159
cmd, display_name=None, years=None, create_cert=False, cert=None, scopes=None, role=None,
1160-
show_auth_for_sdk=None, skip_assignment=False, keyvault=None):
1160+
show_auth_in_json=None, skip_assignment=False, keyvault=None):
11611161
import time
11621162

11631163
if role and not scopes or not role and scopes:
@@ -1272,7 +1272,7 @@ def create_service_principal_for_rbac(
12721272

12731273
logger.warning(CREDENTIAL_WARNING)
12741274

1275-
if show_auth_for_sdk:
1275+
if show_auth_in_json:
12761276
from azure.cli.core._profile import Profile
12771277
profile = Profile(cli_ctx=cmd.cli_ctx)
12781278
result = profile.get_sp_auth_info(scopes[0].split('/')[2] if scopes else None,

0 commit comments

Comments
 (0)