Wednesday, February 28, 2024

Uploading large files using Azure Storage REST API

When uploading files that are over 250 MB to Azure storage using the Azure Blob REST API will require you to break the file into multiple blocks that can be upto 100 MB. Use the Put Block operation to write each of the blocks to the storage. Then use the Put Block List operation to write a blob that specifies the list of block IDs that make up the blob. 

blog@aileronconsulting.com

Friday, February 16, 2024

Azure App Gateway with Certificate in Key Vault

It is common practice to utilize the Azure App Gateway for your web apps. SSL traffic would terminate at the gateway in this scenario. Wouldn't it be nice if you didn't have to worry about renewing your SSL certificate manually. You can do that by using the App Service Certificates and storing them in a Key Vault. The only problem is that as of the writing of this post (Feb 2024), the Azure Portal does not support App Gateway (Standard V2 tier) reading certificates from the Key Vault. According to this document https://learn.microsoft.com/en-us/azure/application-gateway/key-vault-certs#supported-certificates, this can only be accomplished via "non-portal resources like PowerShell, the Azure CLI, APIs, and Azure Resource Manager templates (ARM templates)".

 The alternative is to export the certificate and manually import the PFX file into the Key Vault. You will have to remember to do this when you renew the certificate.

Hopefully this feature will be added to the Azure Portal soon.

blog@aileronconsulting.com

Thursday, February 1, 2024

cUrl on Powershell

It is sometimes handy to run curl commands from PowerShell. 

Couple things you need to watch out for - 

1) The curl command is aliased to Invoke-WebRequest. If you really want use curl natively, then run this command in your PowerShell window first. 

remove-item alias:curl 

2) If you are POSTing or PUTing raw JSON in the body, then it helps to store the raw json in a file and passing it as a parameter via the -T option. Below is an example 

curl --location --request PUT 'https://Yourendpoint' --header 'Authorization: Bearer <yourtoken>' --header 'Content-Type: application/json' -T 'C:\temp\abc.txt' 

If you use Postman, you can generate the curl command or in other programming languages as well. 

blog@aileronconsulting.com