Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Fix appID in broker-plugin link
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges committed Nov 14, 2022
1 parent c2f553c commit 9979886
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/deployment/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def setup_rbac(self) -> None:

requiredRedirectUris = [
"http://localhost", # required for browser-based auth
"ms-appx-web://Microsoft.AAD.BrokerPlugin/3b5603df-3ddc-464c-a1ea-6a186bdee389", # required for broker auth
f"ms-appx-web://Microsoft.AAD.BrokerPlugin/{onefuzz_cli_app['appId']}", # required for broker auth
]

redirectUris: List[str] = onefuzz_cli_app["publicClient"]["redirectUris"]
Expand Down
24 changes: 17 additions & 7 deletions src/deployment/deploylib/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,6 @@ def create_application_registration(
params = {
"isDeviceOnlyAuthSupported": True,
"displayName": name,
"publicClient": {
"redirectUris": [
"https://%s.azurewebsites.net" % onefuzz_instance_name,
"http://localhost", # required for browser auth
"ms-appx-web://Microsoft.AAD.BrokerPlugin/3b5603df-3ddc-464c-a1ea-6a186bdee389", # required for broker auth
]
},
"isFallbackPublicClient": True,
"requiredResourceAccess": (
[
Expand All @@ -284,6 +277,23 @@ def create_application_registration(
subscription=subscription_id,
)

# next patch the redirect URIs; we must do this
# separately because we need the AppID to include
query_microsoft_graph(
method="PATCH",
resource=f"applications/{registered_app['id']}",
body={
"publicClient": {
"redirectUris": [
"https://%s.azurewebsites.net" % onefuzz_instance_name,
"http://localhost", # required for browser auth
f"ms-appx-web://Microsoft.AAD.BrokerPlugin/{app['appId']}", # required for broker auth
]
},
},
subscription=subscription_id,
)

logger.info("creating service principal")

service_principal_params = {
Expand Down

0 comments on commit 9979886

Please sign in to comment.