util#
Miscellaneous utilities for interacting with Azure.
Functions#
|
Look up an Azure service principal from its display name. |
|
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-itemlist
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
ifx
is aMutableSequence
otherwise[x]
(i.e. a one-item list containingx
).