Skip to content

Commit

Permalink
Add confirm method
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMadge committed Sep 22, 2023
1 parent 79de3ec commit d8c4a61
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions data_safe_haven/external/api/azure_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from dataclasses import dataclass
from shutil import which

import typer

from data_safe_haven.exceptions import DataSafeHavenAzureError
from data_safe_haven.utility import LoggingSingleton

Expand Down Expand Up @@ -55,3 +57,12 @@ def account(self) -> AzureCliAccount:
raise DataSafeHavenAzureError(msg) from exc

return self._account

def confirm(self) -> None:
account = self.account
print(
f"name: {account.name} (id: {account.id_}\n",
f"tenant: {account.tenant_id}"
)
if not typer.confirm("Is this the Azure account you expect?\n"):
typer.Exit()

0 comments on commit d8c4a61

Please sign in to comment.