Shared Configuration In Azure File Share
This guide assumes you have already created a Storage Account and Azure File Share resources.
1. Get Storage Account Name & Access Key
Go to your Storage account > Access Keys
- Storage account name: testingstorageaj
- Access Key: ***
Take note of both in a notepad.
2. Create Local User Account
We need to create a local user account with the same name as the Storage Account and with the same password as well.
Open Computer Management > Local Users and Groups > Users > <right click and create user>.
- Username: <same as Storage Account Name>
- Password: <Access Key>
Also, check the following options:
[X] User cannot change password
[X] Password never expires
3. Add Newly Created Account to IIS_IUSRS Group
While in Computer Management go to >Local Users and Groups > Groups
4. Mount Azure File Share In Windows
Go to your Azure File Share and get the URL.
In my case:
There are two option to mount the drive, we can use “net use” or “New-PSDrive”.
Net use
net use <drive-letter>: \\<storage-account-name>.file.core.windows.net\<share-name> /u:<storage-account-name> <storage-account-key>
Example:
NOTE: In the URL you will have to replace forward slash / with backward slash \
net use Z: \\testingstorageaj.file.core.windows.net\testfileshare /u:testingstorageaj <Access Key>
New-PSDrive
You can get the PowerShell script by going into your File Share > Browse > Connect > Windows > SELECT-LETTER > STORAGE ACCOUNT KEY AUTH > Show Script.
Copy that command and run in in your machine.
Either option you choose, at the end of the day you should see your drive in the file explorer:
5. Exporting Shared Configuration Into Azure File Share
I have created a directory called “sharedconfig” in the File Share, so we save the shared configuration files in here.
Open IIS Manager > Server Level > Shared Configuration > Export Configuration
- Physical Path: \\testingstorageaj.file.core.windows.net\testfileshare\sharedconfig
“Connect as” and use your local account that matches name with the Storage Account:
- Username: testingstorageaj
- Password: <Access Key>
Then, for Encryption Keys you will have to set a password, which is DIFFERENT of the Access Key.
For my password I will use “azureUser123.”.
If all goes well configuration would have been exported and you should be able to see it in the Azure File Share:
6. Enabling Shared Configuration
IIS Manager > Server Level > Shared Configuration >
[X] Enable Shared Configuration
Set credentials:
- Username: testingstorageaj
- Password: <Access Key>
If successfull, it will prompt you for the encryption key. Mine is “azureUser123.”.
Restart IIS by opening CMD and “iisreset /noforce”.
That should be it.