You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Script to change connection settings via Azure CLI in a bash shell
129
+
## Script to change connection settings via Azure CLI
130
+
131
+
> [!IMPORTANT]
132
+
> This script requires the [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
133
+
134
+
### Azure CLI in a bash shell
130
135
131
136
> [!IMPORTANT]
132
137
> This script requires the [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
@@ -138,13 +143,31 @@ The following CLI script shows how to change the connection policy in a bash she
138
143
sqlserverid=$(az sql server show -n sql-server-name -g sql-server-group --query 'id' -o tsv)
139
144
140
145
# Set URI
141
-
id="$sqlserverid/connectionPolicies/Default"
146
+
ids="$sqlserverid/connectionPolicies/Default"
147
+
148
+
# Get current connection policy
149
+
az resource show --ids $ids
150
+
151
+
# Update connection policy
152
+
az resource update --ids $ids --set properties.connectionType=Proxy
153
+
```
154
+
155
+
### Azure CLI from a Windows command prompt
156
+
157
+
> [!IMPORTANT]
158
+
> This script requires the [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
159
+
160
+
The following CLI script shows how to change the connection policy from a Windows command prompt (with Azure CLI installed).
161
+
162
+
```azurecli
163
+
# Get SQL Server ID and set URI
164
+
FOR /F "tokens=*" %g IN ('az sql server show --resource-group myResourceGroup-571418053 --name server-538465606 --query "id" -o tsv') do (SET sqlserverid=%g/connectionPolicies/Default)
142
165
143
166
# Get current connection policy
144
-
az resource show --ids $id
167
+
az resource show --ids %sqlserverid%
145
168
146
169
# Update connection policy
147
-
az resource update --ids $id --set properties.connectionType=Proxy
170
+
az resource update --ids %sqlserverid% --set properties.connectionType=Proxy
0 commit comments