An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
Helllo Battina, Subodh
Thank you for reaching out to Microsoft Q&A.
It looks like you’re trying to use the Get Random Bytes API against a Premium-tier Key Vault.
Below is the resolution:-
• The REST endpoint and client-SDK calls for “Get Random Bytes” are only exposed on Azure Managed HSM resources (i.e. the dedicated HSM offering), not on a standard or Premium Key Vault instance.
• Even though the Premium Key Vault tier uses HSMs under the covers for your keys, it doesn’t surface the random-bytes endpoint. You’d need to deploy a Managed HSM if you want to call that specific API.
If you want HSM-grade random numbers and don’t want to stand up a Managed HSM, you’ll need to generate random data client-side (e.g., via your language’s crypto libraries) or look at another Azure service that meets your needs.
Microsoft docs:
- Get Random Bytes REST API (Managed HSM) https://dori-uw-1.kuma-moon.com/en-us/rest/api/keyvault/keys/get-random-bytes/get-random-bytes?view=rest-keyvault-keys-2025-07-01&tabs=HTTP
- Get-AzKeyVaultRandomNumber PowerShell Cmdlet https://dori-uw-1.kuma-moon.com/powershell/module/az.keyvault/get-azkeyvaultrandomnumber?view=azps-15.5.0
- KeyClient.GetRandomBytes/.GetRandomBytesAsync (.NET SDK) https://dori-uw-1.kuma-moon.com/dotnet/api/azure.security.keyvault.keys.keyclient.getrandombytes?view=azure-dotnet
- Azure Key Vault overview & creating a vault https://docs.microsoft.com/azure/key-vault/general/basic-concepts
Let us know if the above steps works
Thanks