There are so many scenarios I’ve faced over 18 years in integration that required me to generate a unique ID, and I don’t know how to start explaining them all. Unique identifiers are handy when an automation process needs to generate a unique reference “number” to identify an object or entity, like a Customer account, a document ID, and so on. Most of the time, we use GUIDs, which stand for a globally unique identifier, and it is usually a 128-bit text string that represents an identification (ID) that is unlikely ever to repeat or create a collision, to address these scenarios unless requirements don’t allow us to use a GUID.
This is a list of 4 Functions that will allow you to generate unique identifiers:
- GUID Generator: This function has the same capabilities available on the Online GUID / UUID Generator: https://guidgenerator.com/online-guid-generator.aspx.
- Tickets Short GUID Generator: Calculate the uniqueId using the provided year.
- YouTube-like GUID Generator: Function to generate a short GUID like in YouTube (N7Et6c9nL9w).
- Tiny ID Generator: Another way that I used in the past to generate a tiny identifier.
📝 One-Minute Brief
Generating unique identifiers is a common requirement in integration scenarios. This article presents four Azure Functions that generate different types of unique IDs, from standard GUIDs to short and compact identifiers, helping you choose the right approach based on your technical and business requirements.
GUID Generator Function
As mentioned above, this function has the same capabilities as the Online GUID / UUID Generator: https://guidgenerator.com/online-guid-generator.aspx. It accepts 3 optional query parameters:
- useHyphen: accepts the values true or false to decide if you want to generate a guide separated with hyphens.
- The default value is true.
- useUppercase: accepts the values true or false to decide if you want to convert the GUID to upper case.
- The default value is false.
- useBraces: accepts the values true or false to decide if you want to generate a guide between braces.
- The default value is false.

Here is a small sample of the code behind this function:
if (useHyphen)
{
Guid hyphenGuid = Guid.NewGuid();
string finalGuid = "";
if (useBraces)
finalGuid = hyphenGuid.ToString("B");
else finalGuid = hyphenGuid.ToString();
if (useUppercase)
return new OkObjectResult(finalGuid.ToUpper());
return new OkObjectResult(finalGuid);
}
Tickets Short GUID Generator Function
This function generates a unique identifier based on the year. This function accepts 1 optional query parameter:
- year: year to take as a reference for calculating the unique identifier.
- The default value is 1978.

Here is a small sample of the code behind this function:
var ticks = new DateTime(year, 1, 1).Ticks;
var ans = DateTime.Now.Ticks - ticks;
var uniqueId = ans.ToString("x");
YouTube-like GUID Generator Function
This function allows you to generate a short GUID like in YouTube (N7Et6c9nL9w).

This was made just for fun, but here is a small sample of the code behind this function:
tring base64Guid = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
Tiny ID Generator Function
This function is another way that I used in the past, in BizTalk Server projects, to generate a tiny identifier. But looking now that I’m writing this blog post, it looks like a YouTube-like GUID.

Here is a small sample of the code behind this function:
Guid guid = Guid.NewGuid();
string modifiedBase64 = Convert.ToBase64String(guid.ToByteArray())
.Replace('+', '-').Replace('/', '_') // avoid invalid URL characters
.Substring(0, 22);
Where can I download it?
You can download the complete Azure Functions source code here:
Once again, thank my team member, Luis Rigueira, for testing and helping me develop some of these functions with me!
Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego!