简体   繁体   中英

How to set Connection Policy for Azure SQL Server

I'm looking for a way to set Connection Policy to Redirect for my Azure SQL server.

在此处输入图像描述

This is my current definition of SQL Server in Pulumi, but I can't find connection policy anywhere.

var sqlServer = new Pulumi.AzureNative.Sql.Server(sqlServerName, new ServerArgs
{
    ServerName = sqlServerName,
    ResourceGroupName = resourceGroup.Name,
    Location = resourceGroup.Location,
    Version = "12.0",
    MinimalTlsVersion = "1.2",
    AdministratorLogin = dbLogin,
    AdministratorLoginPassword = dbPassword,
    PublicNetworkAccess = ServerPublicNetworkAccess.Disabled,
});

When I export server resource I see it's defined as a separated resource type called Microsoft.Sql/servers/connectionPolicies but can't find it within Pulumi types

{
    "type": "Microsoft.Sql/servers/connectionPolicies",
    "apiVersion": "2021-08-01-preview",
    "name": "[concat(parameters('..'), '/default')]",
    "location": "uksouth",
    "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('..'))]"
    ],
    "properties": {
        "connectionType": "Redirect"
    }
},

I'm looking for a way to set Connection Policy to Redirect for my Azure SQL server.

As currently, its missing in Pulumi as suggested by @ Mikhail Shilkov you can open an Issue in GitHub.

But you can try to update the connection policy in azure sql server till its not added in pulumi

To do that we can configure it in multiple ways for example using Azure Cli and python etc.

For example using CLI we have tried as below:-

az sql server conn-policy show --resource-group RGNAME --server SERVERNAME

在此处输入图像描述

az sql server conn-policy update --connection-type Redirect--resource-group RGNAME --server SERVERNAME

在此处输入图像描述

在此处输入图像描述

To achieve it in other way please refer this: Pulumi Docs| SQL SERVER

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM