Skip to content

Commit 92723ef

Browse files
authored
[Microsoft Entra ID] az ad sp create-for-rbac: Add --service-management-reference argument (#31212)
1 parent 7472adf commit 92723ef

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
@@ -1217,7 +1217,9 @@ def list_service_principal_owners(client, identifier):
12171217
# pylint: disable=inconsistent-return-statements
12181218
def create_service_principal_for_rbac(
12191219
# pylint:disable=too-many-statements,too-many-locals, too-many-branches, unused-argument
1220-
cmd, display_name=None, years=None, create_cert=False, cert=None, scopes=None, role=None,
1220+
cmd, display_name=None,
1221+
service_management_reference=None,
1222+
years=None, create_cert=False, cert=None, scopes=None, role=None,
12211223
show_auth_in_json=None, skip_assignment=False, keyvault=None):
12221224
import time
12231225

@@ -1261,6 +1263,7 @@ def create_service_principal_for_rbac(
12611263
aad_application = create_application(cmd,
12621264
graph_client,
12631265
app_display_name,
1266+
service_management_reference=service_management_reference,
12641267
key_value=public_cert_string,
12651268
start_date=app_start_date,
12661269
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)