HOW TO CREATE FILE SHARE
Published: 2024-05-25 09:55:25

Your company(Hagital Consulting) needs to ensure that backups are in place for all Azure file shares. This is because it’s Staffs often modifyfiles within the file share, file versioning is also important. To test functionality, you are tasked with taking a snapshot of a file share and restoring it to your Windows machine.

	SOLUTION STEPS
•	Create a Storage Account and File Share
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kio8owzykp9aqexaegt6.png)
•	Storage account name: Enter in a globally unique name
•	Location: Set to the same location as the existing resource group
•	Performance: Standard
•	Click Review + create and then Create.
•	Once the storage account has been deployed successfully, click Go to resource.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sz85o2301lm76y7rhoqx.png)

•	Click on File shares in the left side menu.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lss0j3oeuf6qpvu5m9z0.png)
•	Click on + File share.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cw1tlkfm0m1hibc8a6jm.png)

•	Name the fileshare.

•	Click on Review + create and then Create.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nroqn4lbb1s5sbck233q.png)
•	Connect to your VM

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5r15b70emh7q7bdfgm22.png)
•	Once connected, minimize any open windows, click on the magnifying glass to search for Windows Firewall and open Windows Firewall.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cylrfz0vugyh068rqj85.png)

•	In the Windows Firewall window, click on Turn Windows Firewall on or off.

•	Turn the Firewall state to Off. Click Apply and then Ok.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2lc54axzbiuy3xxazj9k.png)
•	Search for Windows PowerShell on your windows VM. Right-click on it, and click on Run as administrator.

•	Back in the Azure portal, open your storage account and then click on File shares on the left menu.
•	Select your file share, and click Connect.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ltxl9dr68fzjxrjidahy.png)
•	In the side window that opens, click on Show Script and copy the PowerShell script to your clipboard.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vul4ipeu4qpcr3oahu36.png)
•	Paste the PowerShell script in the Windows VM PowerShell session to connect the file share. 
•	After a moment, you should get a message that the credential was added successfully.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qiu338dvjfx5hb5iidt9.png)

Take a Snapshot and Restore Data
•	Click in File Explorer at the bottom of the Windows VM.
•	Click on This PC and open your fileshare.
•	Right-click in the fileshare window and click on New > Text Document. Name this document.
•	Open the newly created document and type any words in there
•	Click on File > Save.
•	Return to the Azure Portal and close the Connect side window.
•	Click on Browse in the left side menu and verify that you can see the test.txt file.
Add Snapshots.

•	Click on Add Snapshot and give it a name in the Comment Window before clicking OK.
•	In the Windows VM, add some random text to the test document that you created. Click on File > Save.
•	Return to the Azure Portal.
•	Locate the Snapshot and select to open in up.
•	Select the ellipsis on the right-hand side of the test.txt file.
•	Select Restore
•	Click on Overwrite original file and then OK.
•	Open the test.txt file and you should see that it has reverted to its original text.

-