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

Commit 476c6ab

Browse files
authored
Merge branch 'main' into job_summary
2 parents db902aa + fc4e698 commit 476c6ab

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/deployment/deploy.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def __init__(
147147
create_registration: bool,
148148
migrations: List[str],
149149
export_appinsights: bool,
150-
upgrade: bool,
150+
skip_aad_setup: bool,
151151
subscription_id: Optional[str],
152152
admins: List[UUID],
153153
allowed_aad_tenants: List[UUID],
@@ -168,7 +168,7 @@ def __init__(
168168
self.third_party = third_party
169169
self.create_registration = create_registration
170170
self.custom_domain = custom_domain
171-
self.upgrade = upgrade
171+
self.skip_aad_setup = skip_aad_setup
172172
self.results: Dict = {
173173
"client_id": client_id,
174174
"client_secret": client_secret,
@@ -465,12 +465,13 @@ def setup_rbac(self) -> None:
465465
subscription=self.get_subscription_id(),
466466
)
467467

468-
assign_instance_app_role(
469-
self.application_name,
470-
onefuzz_cli_app["displayName"],
471-
self.get_subscription_id(),
472-
OnefuzzAppRole.ManagedNode,
473-
)
468+
if not self.skip_aad_setup:
469+
assign_instance_app_role(
470+
self.application_name,
471+
onefuzz_cli_app["displayName"],
472+
self.get_subscription_id(),
473+
OnefuzzAppRole.CliClient,
474+
)
474475

475476
self.results["client_id"] = app["appId"]
476477
self.results["client_secret"] = password
@@ -736,7 +737,7 @@ def deploy_template(self) -> None:
736737
raise Exception("unknown error deploying")
737738

738739
def assign_scaleset_identity_role(self) -> None:
739-
if self.upgrade:
740+
if self.skip_aad_setup:
740741
logger.info("Upgrading: skipping assignment of the managed identity role")
741742
return
742743
logger.info("assigning the user managed identity role")
@@ -748,7 +749,7 @@ def assign_scaleset_identity_role(self) -> None:
748749
)
749750

750751
def assign_user_access(self) -> None:
751-
if self.upgrade:
752+
if self.skip_aad_setup:
752753
logger.info("Upgrading: Skipping assignment of current user to app role")
753754
return
754755
logger.info("assigning user access to service principal")
@@ -1275,9 +1276,9 @@ def main() -> None:
12751276
"password for the pool agent",
12761277
)
12771278
parser.add_argument(
1278-
"--upgrade",
1279+
"--skip_aad_setup",
12791280
action="store_true",
1280-
help="Indicates that the instance is being upgraded",
1281+
help="Assumes that AAD resources already exist, and they do not need to be upgraded.",
12811282
)
12821283
parser.add_argument(
12831284
"--apply_migrations",
@@ -1359,7 +1360,7 @@ def main() -> None:
13591360
create_registration=args.create_pool_registration,
13601361
migrations=args.apply_migrations,
13611362
export_appinsights=args.export_appinsights,
1362-
upgrade=args.upgrade,
1363+
skip_aad_setup=args.skip_aad_setup,
13631364
subscription_id=args.subscription_id,
13641365
admins=args.set_admins,
13651366
allowed_aad_tenants=args.allowed_aad_tenants or [],

0 commit comments

Comments
 (0)