Description Usage Arguments Details Value See Also Examples
These functions are used by get_azure_token
to recognise and properly format tenant and app IDs. is_guid
can also be used generically for identifying GUIDs/UUIDs in any context.
1 2 3 4 5 | normalize_tenant(tenant)
normalize_guid(x)
is_guid(x)
|
tenant |
For |
x |
For |
A tenant can be identified either by a GUID, or its name, or a fully-qualified domain name (FQDN). The rules for normalizing a tenant are:
If tenant
is recognised as a valid GUID, return its canonically formatted value
Otherwise, if it is a FQDN, return it
Otherwise, if it is one of the generic tenants "common", "organizations" or "consumers", return it
Otherwise, append ".onmicrosoft.com" to it
These functions are vectorised. See the link below for the GUID formats they accept.
For is_guid
, a logical vector indicating which values of x
are validly formatted GUIDs.
For normalize_guid
, a vector of GUIDs in canonical format. If any values of x
are not recognised as GUIDs, it throws an error.
For normalize_tenant
, the normalized tenant IDs or names.
get_azure_token
Parsing rules for GUIDs in .NET. is_guid
and normalize_guid
recognise the "N", "D", "B" and "P" formats.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | is_guid("72f988bf-86f1-41af-91ab-2d7cd011db47") # TRUE
is_guid("{72f988bf-86f1-41af-91ab-2d7cd011db47}") # TRUE
is_guid("72f988bf-86f1-41af-91ab-2d7cd011db47}") # FALSE (unmatched brace)
is_guid("microsoft") # FALSE
# all of these return the same value
normalize_guid("72f988bf-86f1-41af-91ab-2d7cd011db47")
normalize_guid("{72f988bf-86f1-41af-91ab-2d7cd011db47}")
normalize_guid("(72f988bf-86f1-41af-91ab-2d7cd011db47)")
normalize_guid("72f988bf86f141af91ab2d7cd011db47")
normalize_tenant("microsoft") # returns 'microsoft.onmicrosoft.com'
normalize_tenant("microsoft.com") # returns 'microsoft.com'
normalize_tenant("72f988bf-86f1-41af-91ab-2d7cd011db47") # returns the GUID
# vector arguments are accepted
ids <- c("72f988bf-86f1-41af-91ab-2d7cd011db47", "72f988bf86f141af91ab2d7cd011db47")
is_guid(ids)
normalize_guid(ids)
normalize_tenant(c("microsoft", ids))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.