I am calling Dos2Unix(filePath) method before copying file from Azure function to WASB.
Call method:-
Dos2Unix(D:\home\site\repository\sample.sh);
Following method actually works for me in C# Azure function.
private void Dos2Unix(string fileName)
{
    const byte CR = 0x0D;
    const byte LF = 0x0A;
    byte[] data = File.ReadAllBytes(fileName);
    using (FileStream fileStream = File.OpenWrite(fileName))
    {
        BinaryWriter bw = new BinaryWriter(fileStream);
        int position = 0;
        int index = 0;
        do
        {
            index = Array.IndexOf<byte>(data, CR, position);
            if ((index >= 0) && (data[index + 1] == LF))
            {
                // Write before the CR
                bw.Write(data, position, index - position);
                // from LF
                position = index + 1;
            }
        }
        while (index >= 0);
        bw.Write(data, position, data.Length - position);
        fileStream.SetLength(fileStream.Position);
    }
}
Update 1:-
Here is my code to upload files(*.sh, *.jar, *.img, etc) to blob storage.
public bool UploadBlobFile(string containerName, string blobName, string filePath)
{
    try{
        CloudBlobContainer container = blobClient.GetContainerReference(containerName);
        CloudBlockBlob blob = container.GetBlockBlobReference(blobName);
        // convert dos2unix format
        Dos2Unix(filePath);
        using (var fileStream = System.IO.File.OpenRead(filePath))
        {
            blob.UploadFromStream(fileStream);
        }
        return true;
    } catch (Exception e) {
        log.Info("Exception: " + e);
        return false;
    }
}