util ==== .. py:module:: util .. autoapi-nested-parse:: Miscellaneous utilities for interacting with Azure. Functions --------- .. autoapisummary:: util.lookup_service_principal util.ensure_listlike Module Contents --------------- .. py:function:: 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. .. py:function:: ensure_listlike(x: any) -> collections.abc.MutableSequence Ensure that an object either behaves like a :class:`MutableSequence` and if not return a one-item :class:`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 :class:`list`-like. Returns ------- MutableSequence ``x`` if ``x`` is a :class:`MutableSequence` otherwise ``[x]`` (i.e. a one-item list containing ``x``).