File tree Expand file tree Collapse file tree
examples/entraid/applications Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99https://learn.microsoft.com/en-us/graph/api/application-addpassword
1010"""
1111
12+ import sys
13+
14+ from office365 .directory .permissions .guard import has_role
1215from office365 .graph_client import GraphClient
13- from tests import test_client_id , test_client_secret , test_tenant
16+ from tests import test_admin_principal_name , test_client_id , test_tenant
1417
1518
1619def main ():
17- client = GraphClient (tenant = test_tenant ).with_client_secret (test_client_id , test_client_secret )
20+ client = GraphClient (tenant = test_tenant ).with_token_interactive (test_client_id , test_admin_principal_name )
21+ if not has_role (client , "Global Administrator" , "Privileged Role Administrator" ):
22+ print ("Need Global Administrator or Privileged Role Administrator role to grant permissions." )
23+ sys .exit (1 )
1824
1925 app = client .applications .get_by_app_id (test_client_id )
2026 result = app .add_password ("Rotated secret" ).execute_query ()
21-
22- print (f"{ app .display_name or app .app_id } : { result .value .secretText } " )
27+ print (f"CLIENT_SECRET={ result .value .secretText } " )
2328
2429
2530if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments