Hi @razec18
Welcome to Microsoft Q&A Forum. Thanks for posting your query here!
I understand that you would like to Secure Access to Storage Account for a Custom Script Used During VM Creation.
Yes, by implementing a private endpoint is a good approach to secure your storage account while allowing access from virtual machines (VMs). A private endpoint provides secure connectivity between clients on your virtual network (VNet) and your storage account, ensuring that the traffic does not traverse the public internet, which eliminates exposure to the public internet. This setup allows the VMs to securely retrieve the custom PowerShell script without the risks associated with public access.
Firstly, create a private endpoint- Go to the Azure portal, navigate to your storage account, and create a new Private Endpoint.
Once the private end point is created, configure the Private Endpoint by selecting the virtual network and subnet where your VMs will be created.
And then modify your VM creation script to use the Private Endpoint's IP address or DNS name to access the storage account.
Additionally, you can configure the storage firewall to block connections from the public endpoint, further securing your storage account.
For more additional information, please refer the following documents:
Connect to a storage account using an Azure private endpoint
Use private endpoints for Azure Storage
Hope this helps in resolving the issue.
Please let us know if this solves the issue and do let us know if you have any further queries.
Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.