Skip to content

Commit c13329a

Browse files
committed
service_management_reference
1 parent 6f3fa67 commit c13329a

6 files changed

Lines changed: 610 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,9 @@
516516

517517
helps['ad sp create-for-rbac'] = """
518518
type: command
519-
short-summary: Create a service principal and configure its access to Azure resources.
519+
short-summary: >
520+
Create an application and its associated service principal, optionally configure the service principal's
521+
RBAC role assignments.
520522
long-summary: >-
521523
The output includes credentials that you must protect. Be sure that you do not include these credentials
522524
in your code or check the credentials into your source control. As an alternative, consider using

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ def load_arguments(self, _):
198198
deprecate_info=c.deprecate(target='--sdk-auth'),
199199
help='Output service principal credential along with cloud endpoints in JSON format. ',
200200
arg_type=get_three_state_flag())
201+
c.argument('service_management_reference',
202+
help='Set the serviceManagementReference property of the created application. '
203+
'Reference application or service contact information from a Service or Asset Management '
204+
'database.')
201205

202206
with self.argument_context('ad sp owner list') as c:
203207
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,9 @@ def list_service_principal_owners(client, identifier):
12051205
# pylint: disable=inconsistent-return-statements
12061206
def create_service_principal_for_rbac(
12071207
# pylint:disable=too-many-statements,too-many-locals, too-many-branches, unused-argument
1208-
cmd, display_name=None, years=None, create_cert=False, cert=None, scopes=None, role=None,
1208+
cmd, display_name=None,
1209+
service_management_reference=None,
1210+
years=None, create_cert=False, cert=None, scopes=None, role=None,
12091211
show_auth_in_json=None, skip_assignment=False, keyvault=None):
12101212
import time
12111213

@@ -1249,6 +1251,7 @@ def create_service_principal_for_rbac(
12491251
aad_application = create_application(cmd,
12501252
graph_client,
12511253
app_display_name,
1254+
service_management_reference=service_management_reference,
12521255
key_value=public_cert_string,
12531256
start_date=app_start_date,
12541257
end_date=app_end_date)

src/azure-cli/azure/cli/command_modules/role/linter_exclusions.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ ad app federated-credential delete:
6666
federated_identity_credential_id_or_name:
6767
rule_exclusions:
6868
- option_length_too_long
69+
ad sp create-for-rbac:
70+
parameters:
71+
service_management_reference:
72+
rule_exclusions:
73+
- option_length_too_long
6974
role assignment list:
7075
parameters:
7176
fill_role_definition_name:

0 commit comments

Comments
 (0)