@Supriya Gupta
AzCopy is not part of PowerShell which is probably why it works when you run the script locally but not from VS. Since you are using PowerShell I recommend using Set-AzStorageBlobContent to upload the blob. You also might find this Stack Overflow thread helpful.
-------------------------------
Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.