= Enable Continuous Access share
:toc:
:icons:
:linkattrs:
:imagesdir: ../resources/images


== Summary

This section will create a Continuous Access (CA) share for High Availability (HA) Microsoft SQL Server for active database files.

Microsoft SQL Server can be deployed with an SMB file share as the storage option for active data files. Amazon FSx is optimized to provide shared storage for SQL Server databases by supporting Continuously Available (CA) file shares, which are designed for applications such as SQL Server that require uninterrupted access to shared file data.


== Duration

NOTE: It will take approximately 10 minutes to complete this section.


== Step-by-step Guide

=== Enable Continuous Access share

IMPORTANT: Read through all steps below and watch the quick video before continuing.

image::enable-ca.gif[align="left", width=600]

. From the link:https://console.aws.amazon.com/fsx/[Amazon FSx] console, *_click_* the link to the *STG326 - MAZ* file system and *_select_* the *Network & security* tab. *_Copy_* the *DNS Name* of the file system to the clipboard.

. Go to the remote desktop session for your *Windows Instance 0*.

. *_Start_* *File Explorer*.

. *_Context-click_* *This PC* and *_select_* *Map network drive...*

. Map the file share using the following information:
+
[cols="3,10"]
|===
| *Drive*
a| Y:

| *Folder*
a| This is the UNC path of the file system's default file share. From the link:https://console.aws.amazon.com/fsx/[Amazon FSx] console, *_click_* the link to the *STG326 - MAZ* file system and *_select_* the *Network & security* tab. *_Copy_* the *DNS Name* of the file system to the clipboard and paste it as the first part of the UNC path. *_Add_* *\d$* to the end of the *DNS Name* to complete the UNC path to the file system's hidden administrative share (e.g. \\fs-0123456789abcdef.example.com\d$).

| *Reconnect at sign-in*
a| Leave checked

| *Connect using different credentials*
a| Leave unchecked
|===
+
. In the *File Explorer* window of the *Y:* drive, create new folder. *_Context-click_* >> *New* >> *Folder*. Name the folder *sql*.


. *_Copy_* the script below into your favorite text editor.
+
[source,bash]
----
$WindowsRemotePowerShellEndpoint = "windows_remote_powershell_endpoint" # e.g. "fs-0123456789abcdef.example.com"
enter-pssession -ComputerName ${WindowsRemotePowerShellEndpoint} -ConfigurationName FsxRemoteAdmin

----
+

. From the link:https://console.aws.amazon.com/fsx/[Amazon FSx] console, *_click_* the link to the *STG326 - MAZ* file system and *_select_* the *Network & security* tab. *_Copy_* the *Windows Remote PowerShell Endpoint* of the file system to the clipboard (e.g. fs-0123456789abcdef.example.com).

. Return to your favorite text editor and replace *"windows_remote_powershell_endpoint"* with the *Windows Remote PowerShell Endpoint* of *STG326 - MAZ*. *_Copy_* the updated script.

. Go to the remote desktop session for your *Windows Instance 0*.

. *_Click_* *Start* >> *Windows PowerShell*.

. *_Run_* the updated script in the *Windows PowerShell* window.

+
NOTE: Complete the next few steps using the remote PowerShell session to the FSx file server.
+

. *_Run_* the script in the *Remote Windows PowerShell Session*.

+
[source,bash]
----
New-FSxSmbShare -Name "SQL CA Share" -Path "D:\sql" -Description "SQL CA share" -ContinuouslyAvailable $True -FolderEnumerationMode AccessBased -EncryptData $true

----
+

. Open the link:https://console.aws.amazon.com/secretsmanager/[AWS Secrets Manager] console.
+
TIP: *_Context-click (right-click)_* the link above and open the link in a new tab or window to make it easy to navigate between this github tutorial and AWS console.
+
. *_Select_* the *Secret name* link for *Password-<GUID>*.

. *_Scroll_* to the *Secret value* section and *_click_* the *Retrieve secret value* button.

. Use the *Secret key/value* pairs of *username* and *password* as the credentials to authenticate the *Windows PowerShell Credentials Request* window.

Windows Server Failover Cluster deployments commonly deploy an SMB file share witness to maintain quorum of the cluster’s resources. Witness file shares require only a small amount of storage for quorum information. Amazon FSx file systems can be used as an SMB file share witness for Windows Server Failover Cluster deployments.


== Delete environment

Click the button below to go to the next section.

image::11-delete-environment.png[link=../11-delete-environment/, align="left",width=420]

