# Microsoft Azure REST API - Authorization Rejection due to 'Content-Length'

**URL:** <https://forum.inductiveautomation.com/t/microsoft-azure-rest-api-authorization-rejection-due-to-content-length/45032>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [March 29, 2021, 9:25pm UTC](https://forum.inductiveautomation.com/t/microsoft-azure-rest-api-authorization-rejection-due-to-content-length/45032 "2021-03-29T21:25:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonas.wells](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonas.wells/32/24861_2.png) [@jonas.wells](https://forum.inductiveautomation.com/u/jonas.wells)\
**Post date:** [March 29, 2021, 9:25pm UTC](https://forum.inductiveautomation.com/t/microsoft-azure-rest-api-authorization-rejection-due-to-content-length/45032/1 "2021-03-29T21:25:08Z")

</div>

Hello all,

I have encountered a problem when uploading files to an Azure BLOB Storage Account. More specifically, the ‘Content-Length’ parameter required in the Authorization Header (for the request) is unable to be computed dynamically. I am using the Component Upload component, and calling the event.file.getBytes() method to determine the ‘Content-Length’ parameter. The documentation that I have found indicates that this should in fact be the number needed to authorize the request. However, the Server response is a failure and returns a ‘Content-Length’ that does not match the one provided by Ignitions library method. Additionally, the amount by which they mismatch is not close enough to be a simple error. One troubleshooting thought I had was to try and read a file as bytes using a button event and ensure that the Component Upload is not returning an incorrect length. Does anyone have any suggestions as to what may be causing this issue?

Thanks,  
Jonas

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 29, 2021, 9:28pm UTC](https://forum.inductiveautomation.com/t/microsoft-azure-rest-api-authorization-rejection-due-to-content-length/45032/2 "2021-03-29T21:28:46Z")

</div>

Have you seen this topic?

> [@system.net.httpClient().request() is doing some uncommanded encoding on my binary data](http://forum.inductiveautomation.com/t/system-net-httpclient-request-is-doing-some-uncommanded-encoding-on-my-binary-data/45003):
>
> I would like to have my Vision client user select a file, and then use system.net.httpClient() to POST the contents of that file via HTTP. According to the documentation, the following should work. h = system.net.httpClient() path = 'C:\pathtomyfile' bytes= system.file.readFileAsBytes(path).tostring() # returns a byte string of the file data print(len(bytes)) # sanity check to make sure that our byte string has been imported correctly into memory h.request("http://example.com","POST",data=byt…
