Skip to content

Commit 539e61c

Browse files
authored
add support for enable public network access (#19508)
1 parent dfdb731 commit 539e61c

File tree

7 files changed

+80
-8
lines changed

7 files changed

+80
-8
lines changed

src/Synapse/Synapse/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Added EnablePublicNetworkAccess parameter to `New-AzureSynapseWorkspace` and `Update-AzSynapseWorkspace`
2223

2324
## Version 1.6.0
2425
* Updated `New-AzSynapseSparkPool` and `Update-AzSynapseSparkPool` to support for setting spark pool dynamic executor allocation by `-EnableDynamicExecutorAllocation`

src/Synapse/Synapse/Commands/ManagementCommands/Workspace/NewAzureSynapseWorkspace.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using Microsoft.Azure.Commands.Synapse.Common;
2323
using Microsoft.Azure.Commands.Common.Exceptions;
2424
using Microsoft.WindowsAzure.Commands.Utilities.Common;
25+
using static Microsoft.Azure.Commands.Synapse.Models.SynapseConstants;
2526

2627
namespace Microsoft.Azure.Commands.Synapse
2728
{
@@ -93,6 +94,10 @@ public class NewAzureSynapseWorkspace : SynapseManagementCmdletBase
9394
[ValidateNotNull]
9495
public PSWorkspaceRepositoryConfiguration GitRepository { get; set; }
9596

97+
[Parameter(Mandatory = false, HelpMessage = HelpMessages.PublicNetworkAccess)]
98+
[ValidateNotNull]
99+
public bool EnablePublicNetworkAccess { get; set; }
100+
96101
public override void ExecuteCmdlet()
97102
{
98103
try
@@ -153,7 +158,8 @@ public override void ExecuteCmdlet()
153158
}
154159
}
155160
} : null,
156-
WorkspaceRepositoryConfiguration = this.IsParameterBound(c => c.GitRepository) ? this.GitRepository.ToSdkObject() : null
161+
WorkspaceRepositoryConfiguration = this.IsParameterBound(c => c.GitRepository) ? this.GitRepository.ToSdkObject() : null,
162+
PublicNetworkAccess = this.IsParameterBound(c => c.EnablePublicNetworkAccess) ? (this.EnablePublicNetworkAccess? PublicNetworkAccess.Enabled : PublicNetworkAccess.Disabled): null
157163
};
158164

159165
if (ShouldProcess(Name, string.Format(Resources.CreatingSynapseWorkspace, this.ResourceGroupName, this.Name)))

src/Synapse/Synapse/Commands/ManagementCommands/Workspace/UpdateAzureSynapseWorkspace.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2525
using System.Collections;
2626
using System.Management.Automation;
27+
using static Microsoft.Azure.Commands.Synapse.Models.SynapseConstants;
2728
using SecureString = System.Security.SecureString;
2829

2930
namespace Microsoft.Azure.Commands.Synapse
@@ -80,6 +81,10 @@ public class UpdateAzureSynapseWorkspace : SynapseManagementCmdletBase
8081
[ValidateNotNull]
8182
public PSWorkspaceRepositoryConfiguration GitRepository { get; set; }
8283

84+
[Parameter(Mandatory = false, HelpMessage = HelpMessages.PublicNetworkAccess)]
85+
[ValidateNotNull]
86+
public bool EnablePublicNetworkAccess { get; set; }
87+
8388
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
8489
public SwitchParameter AsJob { get; set; }
8590

@@ -135,6 +140,7 @@ public override void ExecuteCmdlet()
135140
}
136141
} : null;
137142
patchInfo.WorkspaceRepositoryConfiguration = this.IsParameterBound(c => c.GitRepository) ? this.GitRepository.ToSdkObject() : null;
143+
patchInfo.PublicNetworkAccess = this.IsParameterBound(c => c.EnablePublicNetworkAccess) ? (this.EnablePublicNetworkAccess ? PublicNetworkAccess.Enabled : PublicNetworkAccess.Disabled): existingWorkspace.PublicNetworkAccess;
138144

139145
if (ShouldProcess(this.Name, string.Format(Resources.UpdatingSynapseWorkspace, this.Name, this.ResourceGroupName)))
140146
{

src/Synapse/Synapse/Common/HelpMessages.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public static class HelpMessages
4646

4747
public const string GitRepository = "Git Repository Settings. Connect workspace to the repository for source control and collaboration for work on your workspace pipelines";
4848

49+
public const string PublicNetworkAccess = "Enable or Disable public network access to workspace. Possible values include: 'Enabled', 'Disabled'";
50+
4951
public const string RepositoryType = "Select the repository type that you want to use to store your artifacts for this Synapse Analytics workspace, the type include DevOps and GitHub.";
5052

5153
public const string HostName = "GitHub Enterprise host name. For example: https://github.mydomain.com";

src/Synapse/Synapse/Models/SynapseConstants.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ public enum PackageActionType
308308
Remove
309309
}
310310

311+
public class PublicNetworkAccess
312+
{
313+
public const string Enabled = "Enabled";
314+
public const string Disabled = "Disabled";
315+
}
316+
311317
public const string SparkConfiguration = nameof(SparkConfiguration);
312318
}
313319
}

src/Synapse/Synapse/help/New-AzSynapseWorkspace.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ New-AzSynapseWorkspace -ResourceGroupName <String> -Name <String> -Location <Str
1818
-SqlAdministratorLoginCredential <PSCredential> [-ManagedVirtualNetwork <PSManagedVirtualNetworkSettings>]
1919
[-EncryptionKeyName <String>] [-EncryptionKeyIdentifier <String>] [-AsJob]
2020
[-ManagedResourceGroupName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>]
21-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
21+
[-EnablePublicNetworkAccess <Boolean>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
22+
[<CommonParameters>]
2223
```
2324

2425
## DESCRIPTION
@@ -47,6 +48,16 @@ The first command creates a managed virtual network configuration. Then the rest
4748

4849
### Example 3
4950
```powershell
51+
$config = New-AzSynapseManagedVirtualNetworkConfig -PreventDataExfiltration -AllowedAadTenantIdsForLinking ContosoTenantId
52+
$password = ConvertTo-SecureString "Password123!" -AsPlainText -Force
53+
$creds = New-Object System.Management.Automation.PSCredential ("ContosoUser", $password)
54+
New-AzSynapseWorkspace -ResourceGroupName ContosoResourceGroup -Name ContosoWorkspace -Location northeurope -DefaultDataLakeStorageAccountName ContosoAdlGen2Storage -DefaultDataLakeStorageFilesystem ContosoFileSystem -SqlAdministratorLoginCredential $creds -ManagedVirtualNetwork $config -EnablePublicNetworkAccess $True
55+
```
56+
57+
The first command creates a managed virtual network configuration. Then the rest methods uses the configuration to creates a new Synapse workspace with enabled managed virtual network and enabled public network access.
58+
59+
### Example 4
60+
```powershell
5061
$password = ConvertTo-SecureString "Password123!" -AsPlainText -Force
5162
$creds = New-Object System.Management.Automation.PSCredential ("ContosoUser", $password)
5263
$config = New-AzSynapseGitRepositoryConfig -RepositoryType GitHub -AccountName ContosoAccount -RepositoryName ContosoRepo -CollaborationBranch main
@@ -117,6 +128,21 @@ Accept pipeline input: False
117128
Accept wildcard characters: False
118129
```
119130
131+
### -EnablePublicNetworkAccess
132+
Enable or Disable public network access to workspace. Possible values include: 'Enabled', 'Disabled'
133+
134+
```yaml
135+
Type: System.Boolean
136+
Parameter Sets: (All)
137+
Aliases:
138+
139+
Required: False
140+
Position: Named
141+
Default value: None
142+
Accept pipeline input: False
143+
Accept wildcard characters: False
144+
```
145+
120146
### -EncryptionKeyIdentifier
121147
Key identifier should be in the format of: https://{keyvaultname}.vault.azure.net/keys/{keyname}.
122148

src/Synapse/Synapse/help/Update-AzSynapseWorkspace.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,27 @@ Updates a Synapse Analytics workspace.
1616
```
1717
Update-AzSynapseWorkspace [-ResourceGroupName <String>] -Name <String> [-Tag <Hashtable>]
1818
[-SqlAdministratorLoginPassword <SecureString>] [-ManagedVirtualNetwork <PSManagedVirtualNetworkSettings>]
19-
[-EncryptionKeyName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>] [-AsJob]
20-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
19+
[-EncryptionKeyName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>]
20+
[-EnablePublicNetworkAccess <Boolean>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
21+
[-Confirm] [<CommonParameters>]
2122
```
2223

2324
### SetByInputObjectParameterSet
2425
```
2526
Update-AzSynapseWorkspace -InputObject <PSSynapseWorkspace> [-Tag <Hashtable>]
2627
[-SqlAdministratorLoginPassword <SecureString>] [-ManagedVirtualNetwork <PSManagedVirtualNetworkSettings>]
27-
[-EncryptionKeyName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>] [-AsJob]
28-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
28+
[-EncryptionKeyName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>]
29+
[-EnablePublicNetworkAccess <Boolean>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
30+
[-Confirm] [<CommonParameters>]
2931
```
3032

3133
### SetByResourceIdParameterSet
3234
```
3335
Update-AzSynapseWorkspace -ResourceId <String> [-Tag <Hashtable>]
3436
[-SqlAdministratorLoginPassword <SecureString>] [-ManagedVirtualNetwork <PSManagedVirtualNetworkSettings>]
35-
[-EncryptionKeyName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>] [-AsJob]
36-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
37+
[-EncryptionKeyName <String>] [-GitRepository <PSWorkspaceRepositoryConfiguration>]
38+
[-EnablePublicNetworkAccess <Boolean>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
39+
[-Confirm] [<CommonParameters>]
3740
```
3841

3942
## DESCRIPTION
@@ -71,6 +74,13 @@ Update-AzSynapseWorkspace -Name ContosoWorkspace -GitRepository $config
7174

7275
This commands updates Git repository which workspace is conneceted to for the specififed Azure Synapse Analytics workspace.
7376

77+
### Example 5
78+
```powershell
79+
Update-AzSynapseWorkspace -Name ContosoWorkspace -EnablePublicNetworkAccess $True
80+
```
81+
82+
This commands updates the specififed Azure Synapse Analytics workspace to enable public network access.
83+
7484
## PARAMETERS
7585

7686
### -AsJob
@@ -103,6 +113,21 @@ Accept pipeline input: False
103113
Accept wildcard characters: False
104114
```
105115
116+
### -EnablePublicNetworkAccess
117+
Enable or Disable public network access to workspace. Possible values include: 'Enabled', 'Disabled'
118+
119+
```yaml
120+
Type: System.Boolean
121+
Parameter Sets: (All)
122+
Aliases:
123+
124+
Required: False
125+
Position: Named
126+
Default value: None
127+
Accept pipeline input: False
128+
Accept wildcard characters: False
129+
```
130+
106131
### -EncryptionKeyName
107132
The workspace encryption key name.
108133

0 commit comments

Comments
 (0)