MCPcopy Index your code
hub / github.com/microsoft/PyRIT / run_az

Function run_az

infra/deploy_instance.py:54–82  ·  view source on GitHub ↗

Run an Azure CLI command. Args: args (list[str]): The az CLI arguments (without the leading 'az'). capture (bool): Whether to capture stdout/stderr. Defaults to True. check (bool): Whether to raise on non-zero exit. Defaults to True. Returns: subprocess

(
    *,
    args: list[str],
    capture: bool = True,
    check: bool = True,
)

Source from the content-addressed store, hash-verified

52
53
54def run_az(
55 *,
56 args: list[str],
57 capture: bool = True,
58 check: bool = True,
59) -> subprocess.CompletedProcess[str]:
60 """
61 Run an Azure CLI command.
62
63 Args:
64 args (list[str]): The az CLI arguments (without the leading 'az').
65 capture (bool): Whether to capture stdout/stderr. Defaults to True.
66 check (bool): Whether to raise on non-zero exit. Defaults to True.
67
68 Returns:
69 subprocess.CompletedProcess[str]: The completed process.
70
71 Raises:
72 subprocess.CalledProcessError: If the command fails and check is True.
73 """
74 cmd = ["az"] + args
75 logger.debug("Running: %s", " ".join(cmd))
76 return subprocess.run(
77 cmd,
78 capture_output=capture,
79 text=True,
80 check=check,
81 shell=_SHELL,
82 )
83
84
85def run_az_json(*, args: list[str]) -> dict | list | str:

Callers 11

run_az_jsonFunction · 0.70
set_subscriptionFunction · 0.70
create_resource_groupFunction · 0.70
create_entra_appFunction · 0.70
assign_groups_to_appFunction · 0.70
create_sql_server_and_dbFunction · 0.70
create_storage_accountFunction · 0.70
create_key_vaultFunction · 0.70
post_deployFunction · 0.70
_grant_aoai_rolesFunction · 0.70

Calls 1

runMethod · 0.45

Tested by

no test coverage detected