Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit db24930

Browse files
Merge pull request #35436 from MicrosoftDocs/main
Auto Publish – main to live - 2025-09-26 22:30 UTC
2 parents eb49de9 + e21ebb7 commit db24930

54 files changed

Lines changed: 2633 additions & 2672 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

azure-sql/includes/sql-vm-powershell.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
---
22
author: MikeRayMSFT
33
ms.author: mikeray
4-
ms.date: 11/25/2018
4+
ms.reviewer: mathoma
5+
ms.date: 09/22/2025
56
ms.service: azure-vm-sql-server
67
ms.topic: include
7-
ms.custom:
88
---
99

1010
## Start your PowerShell session
11-
1211

13-
Run the [**Connect-Az Account**](/powershell/module/Az.Accounts/Connect-AzAccount) cmdlet and you will be presented with a sign-in screen to enter your credentials. Use the same credentials that you use to sign in to the Azure portal.
12+
Run the [**Connect-AzAccount**](/powershell/module/Az.Accounts/Connect-AzAccount) cmdlet and you're presented with a sign-in screen to enter your credentials. Use the same credentials that you use to sign in to the Azure portal.
1413

1514
```powershell
1615
Connect-AzAccount
1716
```
1817

19-
If you have multiple subscriptions use the [**Set-AzContext**](/powershell/module/az.accounts/set-azcontext) cmdlet to select which subscription your PowerShell session should use. To see what subscription the current PowerShell session is using, run [**Get-AzContext**](/powershell/module/az.accounts/get-azcontext). To see all your subscriptions, run [**Get-AzSubscription**](/powershell/module/az.accounts/get-azsubscription).
18+
If you have multiple subscriptions, use the [**Set-AzContext**](/powershell/module/az.accounts/set-azcontext) cmdlet to select which subscription your PowerShell session should use. To see what subscription the current PowerShell session is using, run [**Get-AzContext**](/powershell/module/az.accounts/get-azcontext). To see all your subscriptions, run [**Get-AzSubscription**](/powershell/module/az.accounts/get-azsubscription).
2019

2120
```powershell
2221
Set-AzContext -SubscriptionId 'aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e'
Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
11
---
22
author: cynthn
33
ms.author: cynthn
4-
ms.date: 10/26/2018
4+
ms.reviewer: mathoma
5+
ms.date: 09/23/2025
56
ms.service: virtual-machines
67
ms.topic: include
7-
ms.custom: sfi-image-nochange
8+
ms.custom:
9+
- sfi-image-nochange
810
---
911
The availability group listener is an IP address and network name that the SQL Server availability group listens on. To create the availability group listener:
1012

1113
1. <a name="getnet"></a>Get the name of the cluster network resource:
1214

13-
a. Use RDP to connect to the Azure virtual machine that hosts the primary replica.
15+
a. Use [Bastion](/azure/bastion/bastion-connect-vm-rdp-windows) to connect to the Azure virtual machine that hosts the primary replica.
1416

15-
b. Open **Failover Cluster Manager**.
17+
b. Open **Failover Cluster Manager**.
1618

17-
c. Select the **Networks** node, and note the cluster network name. Use this name in the `$ClusterNetworkName` variable in the PowerShell script. In the following image, the cluster network name is **Cluster Network 1**:
19+
c. Select the **Networks** node, and note the cluster network name. Use this name in the `$ClusterNetworkName` variable in the PowerShell script. In the following image, the cluster network name is **Cluster Network 1**:
1820

19-
:::image type="content" source="./media/virtual-machines-ag-listener-configure/90-cluster-network-name.png" alt-text="Screenshot that shows a cluster network name in Failover Cluster Manager.":::
21+
:::image type="content" source="./media/virtual-machines-ag-listener-configure/90-cluster-network-name.png" alt-text="Screenshot that shows a cluster network name in Failover Cluster Manager.":::
2022

2123
1. <a name="addcap"></a>Add the client access point. The client access point is the network name that applications use to connect to the databases in an availability group.
2224

23-
a. In **Failover Cluster Manager**, expand the cluster name, and then select **Roles**.
25+
a. In **Failover Cluster Manager**, expand the cluster name, and then select **Roles**.
2426

25-
b. On the **Roles** pane, right-click the availability group name, and then select **Add Resource** > **Client Access Point**.
27+
b. On the **Roles** pane, right-click the availability group name, and then select **Add Resource** > **Client Access Point**.
2628

27-
:::image type="content" source="./media/virtual-machines-ag-listener-configure/92-add-client-access-point.png" alt-text="Screenshot of Failover Cluster Manager that shows selecting the Client Access Point command on the shortcut menu for the availability group.":::
29+
:::image type="content" source="./media/virtual-machines-ag-listener-configure/92-add-client-access-point.png" alt-text="Screenshot of Failover Cluster Manager that shows selecting the Client Access Point command on the shortcut menu for the availability group.":::
2830

29-
c. In the **Name** box, create a name for this new listener.
30-
The name for the new listener is the network name that applications use to connect to databases in the SQL Server availability group.
31+
c. In the **Name** box, create a name for this new listener.
32+
The name for the new listener is the network name that applications use to connect to databases in the SQL Server availability group.
3133

32-
d. To finish creating the listener, select **Next** twice, and then select **Finish**. Don't bring the listener or resource online at this point.
34+
d. To finish creating the listener, select **Next** twice, and then select **Finish**. Don't bring the listener or resource online at this point.
3335

3436
1. Take the cluster role for the availability group offline. In **Failover Cluster Manager**, under **Roles**, right-click the role, and then select **Stop Role**.
3537

3638
1. <a name="congroup"></a>Configure the IP resource for the availability group:
3739

38-
a. Select the **Resources** tab, and then expand the client access point that you created. The client access point is offline.
40+
a. Select the **Resources** tab, and then expand the client access point that you created. The client access point is offline.
3941

4042
:::image type="content" source="./media/virtual-machines-ag-listener-configure/94-new-client-access-point.png" alt-text="Screenshot of Failover Cluster Manager that shows an offline status for a client access point.":::
4143

42-
b. Right-click the IP resource, and then select **Properties**. Note the name of the IP address, and use it in the `$IPResourceName` variable in the PowerShell script.
44+
b. Right-click the IP resource, and then select **Properties**. Note the name of the IP address, and use it in the `$IPResourceName` variable in the PowerShell script.
4345

44-
c. Under **IP Address**, select **Static IP Address**. Set the IP address as the same address that you used when you set the load balancer address on the Azure portal.
46+
c. Under **IP Address**, select **Static IP Address**. Set the IP address as the same address that you used when you set the load balancer address on the Azure portal.
4547

4648
:::image type="content" source="./media/virtual-machines-ag-listener-configure/96-ip-resource.png" alt-text="Screenshot of Failover Cluster Manager that shows the selection of an IP address.":::
4749

4850
1. <a name = "dependencyGroup"></a>Make the SQL Server availability group dependent on the client access point:
4951

50-
a. In **Failover Cluster Manager**, select **Roles**, and then select your availability group.
52+
a. In **Failover Cluster Manager**, select **Roles**, and then select your availability group.
5153

52-
b. On the **Resources** tab, under **Other Resources**, right-click the availability group resource, and then select **Properties**.
54+
b. On the **Resources** tab, under **Other Resources**, right-click the availability group resource, and then select **Properties**.
5355

54-
c. On the **Dependencies** tab, add the name of the client access point (the listener).
56+
c. On the **Dependencies** tab, add the name of the client access point (the listener).
5557

5658
:::image type="content" source="./media/virtual-machines-ag-listener-configure/97-properties-dependencies.png" alt-text="Screenshot of Failover Cluster Manager that shows adding a name on the Dependencies tab.":::
5759

58-
d. Select **OK**.
60+
d. Select **OK**.
5961

6062
1. <a name="listname"></a>Make the client access point dependent on the IP address:
6163

62-
a. In **Failover Cluster Manager**, select **Roles**, and then select your availability group.
64+
a. In **Failover Cluster Manager**, select **Roles**, and then select your availability group.
6365

64-
b. On the **Resources** tab, right-click the client access point under **Server Name**, and then select **Properties**.
66+
b. On the **Resources** tab, right-click the client access point under **Server Name**, and then select **Properties**.
6567

6668
:::image type="content" source="./media/virtual-machines-ag-listener-configure/98-dependencies.png" alt-text="Screenshot of Failover Cluster Manager that shows the Properties menu option for the listener's name.":::
6769

68-
c. Select the **Dependencies** tab. Verify that the IP address is a dependency. If it isn't, set a dependency on the IP address. If multiple resources are listed, verify that the IP addresses have **OR**, not **AND**, dependencies. Then select **OK**.
70+
c. Select the **Dependencies** tab. Verify that the IP address is a dependency. If it isn't, set a dependency on the IP address. If multiple resources are listed, verify that the IP addresses have `OR`, not `AND`, dependencies. Then select **OK**.
6971

7072
:::image type="content" source="./media/virtual-machines-ag-listener-configure/98-properties-dependencies.png" alt-text="Screenshot of the Dependencies tab that shows an IP resource for an availability group.":::
7173

72-
>[!TIP]
73-
>You can validate that the dependencies are correctly configured. In **Failover Cluster Manager**, go to **Roles**, right-click the availability group, select **More Actions**, and then select **Show Dependency Report**. When the dependencies are correctly configured, the availability group is dependent on the network name, and the network name is dependent on the IP address.
74+
> [!TIP]
75+
> You can validate that the dependencies are correctly configured. In **Failover Cluster Manager**, go to **Roles**, right-click the availability group, select **More Actions**, and then select **Show Dependency Report**. When the dependencies are correctly configured, the availability group is dependent on the network name, and the network name is dependent on the IP address.
7476
7577

7678
1. <a name="setparam"></a>Set the cluster parameters in PowerShell:
@@ -90,15 +92,15 @@ The availability group listener is an IP address and network name that the SQL S
9092
$IPResourceName = "<IPResourceName>" # The IP address resource name.
9193
$ListenerILBIP = "<n.n.n.n>" # The IP address of the internal load balancer. This is the static IP address for the load balancer that you configured in the Azure portal.
9294
[int]$ListenerProbePort = <nnnnn>
93-
95+
9496
Import-Module FailoverClusters
9597
9698
Get-ClusterResource $IPResourceName | Set-ClusterParameter -Multiple @{"Address"="$ListenerILBIP";"ProbePort"=$ListenerProbePort;"SubnetMask"="255.255.255.255";"Network"="$ClusterNetworkName";"EnableDhcp"=0}
9799
```
98100

99-
b. Set the cluster parameters by running the PowerShell script on one of the cluster nodes.
101+
b. Set the cluster parameters by running the PowerShell script on one of the cluster nodes.
100102

101-
> [!NOTE]
103+
> [!NOTE]
102104
> If your SQL Server instances are in separate regions, you need to run the PowerShell script twice. The first time, use the `$ListenerILBIP` and `$ListenerProbePort` values from the first region. The second time, use the `$ListenerILBIP` and `$ListenerProbePort` values from the second region. The cluster network name and the cluster IP resource name are also different for each region.
103105
104106
1. Bring the cluster role for the availability group online. In **Failover Cluster Manager**, under **Roles**, right-click the role, and then select **Start Role**.
@@ -109,7 +111,7 @@ If necessary, repeat the preceding steps to set the cluster parameters for the I
109111

110112
1. Right-click **IP Address**, and then select **Properties**.
111113

112-
1. Copy the name of the IP address from **Name**. It might be **Cluster IP Address**.
114+
1. Copy the name of the IP address from **Name**. It might be **Cluster IP Address**.
113115

114116
1. <a name="setwsfcparam"></a>Set the cluster parameters in PowerShell:
115117

@@ -124,29 +126,29 @@ If necessary, repeat the preceding steps to set the cluster parameters for the I
124126
$IPResourceName = "<ClusterIPResourceName>" # The IP address resource name.
125127
$ClusterCoreIP = "<n.n.n.n>" # The IP address of the cluster IP resource. This is the static IP address for the load balancer that you configured in the Azure portal.
126128
[int]$ClusterProbePort = <nnnnn> # The probe port from WSFCEndPointprobe in the Azure portal. This port must be different from the probe port for the availability group listener.
127-
129+
128130
Import-Module FailoverClusters
129-
131+
130132
Get-ClusterResource $IPResourceName | Set-ClusterParameter -Multiple @{"Address"="$ClusterCoreIP";"ProbePort"=$ClusterProbePort;"SubnetMask"="255.255.255.255";"Network"="$ClusterNetworkName";"EnableDhcp"=0}
131133
```
132134

133-
b. Set the cluster parameters by running the PowerShell script on one of the cluster nodes.
135+
b. Set the cluster parameters by running the PowerShell script on one of the cluster nodes.
134136

135-
If any SQL resource is configured to use a port between 49152 and 65536 (the [default dynamic port range for TCP/IP](/windows/client-management/troubleshoot-tcpip-port-exhaust#default-dynamic-port-range-for-tcpip)), add an exclusion for each port. Such resources might include:
137+
If any SQL resource is configured to use a port between 49,152 and 65,536 (the [default dynamic port range for TCP/IP](/windows/client-management/troubleshoot-tcpip-port-exhaust#default-dynamic-port-range-for-tcpip)), add an exclusion for each port. Such resources might include:
136138

137139
- SQL Server database engine
138140
- Always On availability group listener
139141
- Health probe for the failover cluster instance
140142
- Database mirroring endpoint
141-
- Cluster core IP resource
143+
- Cluster core IP resource
142144

143145
Adding an exclusion will prevent other system processes from being dynamically assigned to the same port. For this scenario, configure the following exclusions on all cluster nodes:
144146

145147
- `netsh int ipv4 add excludedportrange tcp startport=58888 numberofports=1 store=persistent`
146148
- `netsh int ipv4 add excludedportrange tcp startport=59999 numberofports=1 store=persistent`
147149

148-
It's important to configure the port exclusion when the port is not in use. Otherwise, the command will fail with a message like "The process cannot access the file because it is being used by another process."
149-
To confirm that the exclusions are configured correctly, use the following command: `netsh int ipv4 show excludedportrange tcp`.
150+
It's important to configure the port exclusion when the port isn't in use. Otherwise, the command will fail with a message like `The process cannot access the file because it is being used by another process`.
151+
To confirm that the exclusions are configured correctly, use the following command: `netsh int ipv4 show excludedportrange tcp`.
150152

151-
>[!WARNING]
152-
>The port for the availability group listener's health probe has to be different from the port for the cluster core IP address's health probe. In these examples, the listener port is 59999 and the cluster core IP address's health probe port is 58888. Both ports require an "allow inbound" firewall rule.
153+
> [!WARNING]
154+
> The port for the availability group listener's health probe has to be different from the port for the cluster core IP address's health probe. In these examples, the listener port is 59999 and the cluster core IP address's health probe port is 58888. Both ports require an "allow inbound" firewall rule.

0 commit comments

Comments
 (0)