util#

Miscellaneous utilities for interacting with Azure.

Functions#

lookup_service_principal(→ list)

Look up an Azure service principal from its display name.

ensure_listlike(→ collections.abc.MutableSequence)

Ensure that an object either behaves like a

Module Contents#

lookup_service_principal(display_name: str) list#

Look up an Azure service principal from its display name.

Requires the Azure CLI.

Parameters#

display_name

The display name of the service principal to look up.

Returns#

list

The results, if any, or an empty list if no match was found.

ensure_listlike(x: any) collections.abc.MutableSequence#

Ensure that an object either behaves like a MutableSequence and if not return a one-item list containing the object.

Useful for handling list-of-strings inputs alongside single strings.

Based on this StackOverflow approach.

Parameters#

x

The item to ensure is list-like.

Returns#

MutableSequence

x if x is a MutableSequence otherwise [x] (i.e. a one-item list containing x).