Skip to content

Commit 5686f05

Browse files
dpg, script provide backward compatibility (Azure#27104)
1 parent 279b266 commit 5686f05

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

eng/mgmt/automation/generate_data.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def parse_args() -> argparse.Namespace:
230230
required=False,
231231
help='Security schemes for authentication. '
232232
'Sample: "AADToken" for AAD credential for OAuth 2.0 authentication; '
233-
'"AzureKey" for Azure key credential; "[AADToken,AzureKey]" for both',
233+
'"AzureKey" for Azure key credential',
234234
)
235235
parser.add_argument(
236236
'--security-scopes',
@@ -283,6 +283,15 @@ def main():
283283
base_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
284284
sdk_root = os.path.abspath(os.path.join(base_dir, SDK_ROOT))
285285

286+
# convert credential-types/credential-scopes to security/security-scopes for backward-compatibility
287+
if not args['security'] and args['credential_types']:
288+
if args['credential_types'] == 'tokencredential':
289+
args['security'] = 'AADToken'
290+
elif args['credential_types'] == 'azurekeycredential':
291+
args['security'] = 'AzureKey'
292+
if not args['security_scopes'] and args['credential_scopes']:
293+
args['security_scopes'] = args['credential_scopes']
294+
286295
succeeded = generate(sdk_root, **args)
287296
if succeeded:
288297
succeeded = compile_package(sdk_root, GROUP_ID, args['module'])

0 commit comments

Comments
 (0)