Skip to content

Az.StorageSync MI GA Release (Shared/storage sync to main) #27376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
67f47a3
[DO NOT MERGE] Az.StorageSync - Allow Migration with no servers (#25957)
ankushbindlish2 Oct 8, 2024
9b931f2
Update Az.psd1
VeryEarly Oct 30, 2024
cec0192
Update AzPreview.psd1
VeryEarly Oct 30, 2024
4434c4b
MI GA New changes (#26548)
ankushbindlish2 Nov 8, 2024
732051e
Update ServerMI components to use ServerMIUtils (#26632)
stefong99 Nov 8, 2024
44bf2ac
Az.StorageSync update
ankushbindlish2 Nov 15, 2024
fdaf685
Add Test Clean keys
ankushbindlish2 Nov 15, 2024
c9ca815
Update CleanKeys.ps1
ankushbindlish2 Nov 15, 2024
6cad61b
review comments
ankushbindlish2 Nov 18, 2024
969dc81
Update RegisterServerCommand.cs
ankushbindlish2 Nov 19, 2024
f2ed219
Merge pull request #26715 from ankushbindlish2/shared/StorageSync
VeryEarly Nov 19, 2024
c00be6b
Merge
ankushbindlish2 Jan 10, 2025
9c91cfb
Merge branch 'shared/StorageSync' into main
ankushbindlish2 Jan 10, 2025
4f5695d
Merge pull request #26996 from ankushbindlish2/main
VeryEarly Jan 14, 2025
06cb595
Az.StorageSync MI GA changes (#27003)
ankushbindlish2 Jan 16, 2025
c3e3fe9
Merge branch 'shared/StorageSync' into main
ankushbindlish2 Jan 17, 2025
6932bc0
Merge pull request #27015 from ankushbindlish2/main
VeryEarly Jan 17, 2025
9b98a82
Az.StorageSync - Update Set-AzStorageSyncServer with ApplicationId Pa…
ankushbindlish2 Jan 17, 2025
cf62fea
Az.StorageSync GA Pipeline Fixes into Shared/storage sync (#27049)
ankushbindlish2 Jan 26, 2025
9b4d1c1
Set-AzStorageSyncServer: Add scenario test (#27069)
stefong99 Feb 5, 2025
9cf20e4
Az.StorageSync Pipeline bugs and improvements [MI GA] (#27051)
ankushbindlish2 Feb 5, 2025
8d060b3
fix branch name for ci pipeline (#27123)
VeryEarly Feb 14, 2025
8d07f93
[Eng] Output target modules when build by pipeline (#27132)
VeryEarly Feb 14, 2025
3732f28
[Eng] Add comment for label Legacy (#27134)
VeryEarly Feb 15, 2025
04bacc1
[Eng] Enable main to be CIed by default (#27135)
VeryEarly Feb 15, 2025
cd44292
fix module path in maunal triggered ci (#27178)
VeryEarly Feb 20, 2025
384f180
Merge remote-tracking branch 'origin/legacy-main-tools-2025-02-14' in…
VeryEarly Feb 21, 2025
14a586b
Merge remote-tracking branch 'origin/main' into yabo/shared/StorageSync
VeryEarly Feb 21, 2025
8469959
Merge pull request #27196 from Azure/yabo/shared/StorageSync
VeryEarly Feb 21, 2025
8f80a5e
Merge remote-tracking branch 'origin/main' into shared/StorageSync
VeryEarly Mar 21, 2025
f3c5303
Regenerate SDK (#27442)
ankushbindlish2 Mar 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public partial interface IRegisteredServersOperations
/// <param name='serverId'>
/// GUID identifying the on-premises server.
/// </param>
/// <param name='identity'>
/// Apply server with newly discovered ApplicationId if available.
/// <param name='parameters'>
/// Body of Registered Server object.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
Expand All @@ -130,7 +130,7 @@ public partial interface IRegisteredServersOperations
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

/// <summary>
/// Delete the given registered server.
Expand Down Expand Up @@ -234,8 +234,8 @@ public partial interface IRegisteredServersOperations
/// <param name='serverId'>
/// GUID identifying the on-premises server.
/// </param>
/// <param name='identity'>
/// Apply server with newly discovered ApplicationId if available.
/// <param name='parameters'>
/// Body of Registered Server object.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
Expand All @@ -249,7 +249,7 @@ public partial interface IRegisteredServersOperations
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

/// <summary>
/// Delete the given registered server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public RegisteredServerUpdateParameters()

/// <param name="identity">Apply server with newly discovered ApplicationId if available.
/// </param>
public RegisteredServerUpdateParameters(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), bool? identity = default(bool?))

/// <param name="applicationId">Apply server with new ServicePrincipal Id
/// </param>
public RegisteredServerUpdateParameters(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), bool? identity = default(bool?), string applicationId = default(string))

: base(id, name, type, systemData)
{
this.Identity = identity;
this.ApplicationId = applicationId;
CustomInit();
}

Expand All @@ -61,5 +65,11 @@ public RegisteredServerUpdateParameters()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.identity")]
public bool? Identity {get; set; }

/// <summary>
/// Gets or sets apply server with new ServicePrincipal Id
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicationId")]
public string ApplicationId {get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ public RegisteredServerUpdateProperties()

/// <param name="identity">Apply server with newly discovered ApplicationId if available.
/// </param>
public RegisteredServerUpdateProperties(bool? identity = default(bool?))

/// <param name="applicationId">Apply server with new ServicePrincipal Id
/// </param>
public RegisteredServerUpdateProperties(bool? identity = default(bool?), string applicationId = default(string))

{
this.Identity = identity;
this.ApplicationId = applicationId;
CustomInit();
}

Expand All @@ -44,5 +48,11 @@ public RegisteredServerUpdateProperties()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "identity")]
public bool? Identity {get; set; }

/// <summary>
/// Gets or sets apply server with new ServicePrincipal Id
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "applicationId")]
public string ApplicationId {get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -542,19 +542,19 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
/// <param name='serverId'>
/// GUID identifying the on-premises server.
/// </param>
/// <param name='identity'>
/// Apply server with newly discovered ApplicationId if available.
/// <param name='parameters'>
/// Body of Registered Server object.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// Send Request
Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders> _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, identity, customHeaders, cancellationToken).ConfigureAwait(false);
Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders> _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}

Expand Down Expand Up @@ -875,8 +875,8 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
/// <param name='serverId'>
/// GUID identifying the on-premises server.
/// </param>
/// <param name='identity'>
/// Apply server with newly discovered ApplicationId if available.
/// <param name='parameters'>
/// Body of Registered Server object.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
Expand All @@ -899,12 +899,16 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{




if (parameters == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
}

if (resourceGroupName == null)
{
Expand Down Expand Up @@ -936,11 +940,6 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serverId");
}

RegisteredServerUpdateParameters parameters = new RegisteredServerUpdateParameters();
if(identity != null)
{
parameters.Identity = identity;
}
// Tracing
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
string _invocationId = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ public static RegisteredServer Create(this IRegisteredServersOperations operatio
/// <param name='serverId'>
/// GUID identifying the on-premises server.
/// </param>
public static RegisteredServer Update(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?))
public static RegisteredServer Update(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters)
{
return ((IRegisteredServersOperations)operations).UpdateAsync(resourceGroupName, storageSyncServiceName, serverId, identity).GetAwaiter().GetResult();
return ((IRegisteredServersOperations)operations).UpdateAsync(resourceGroupName, storageSyncServiceName, serverId, parameters).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -179,9 +179,9 @@ public static RegisteredServer Create(this IRegisteredServersOperations operatio
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async System.Threading.Tasks.Task<RegisteredServer> UpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public static async System.Threading.Tasks.Task<RegisteredServer> UpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, identity, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down Expand Up @@ -336,9 +336,9 @@ public static RegisteredServer BeginCreate(this IRegisteredServersOperations ope
/// <param name='serverId'>
/// GUID identifying the on-premises server.
/// </param>
public static RegisteredServer BeginUpdate(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?))
public static RegisteredServer BeginUpdate(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters)
{
return ((IRegisteredServersOperations)operations).BeginUpdateAsync(resourceGroupName, storageSyncServiceName, serverId, identity).GetAwaiter().GetResult();
return ((IRegisteredServersOperations)operations).BeginUpdateAsync(resourceGroupName, storageSyncServiceName, serverId, parameters).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -359,9 +359,9 @@ public static RegisteredServer BeginCreate(this IRegisteredServersOperations ope
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async System.Threading.Tasks.Task<RegisteredServer> BeginUpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public static async System.Threading.Tasks.Task<RegisteredServer> BeginUpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, identity, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ public StorageSyncManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceCli
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
Expand Down
3 changes: 1 addition & 2 deletions src/StorageSync/StorageSync.Management.Sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ In this directory, run AutoRest:
```
autorest --reset
autorest --use:@autorest/[email protected]
autorest.cmd README.md --version=v2
```

### AutoRest Configuration
Expand All @@ -27,7 +26,7 @@ payload-flattening-threshold: 1

###
``` yaml
commit: 9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0
commit: c29b9330313c91d43a75d9d08144c98071c904d0
input-file:
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-09-01/storagesync.json

Expand Down
39 changes: 39 additions & 0 deletions src/StorageSync/StorageSync.Test/CleanKeys.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Define the directory and file pattern
$directory = "."
$filePattern = "*Test*.json"

# Define a regex pattern to match the specific pattern for Storage Account keys ending with ==
$pattern = '\\\"value\\\":\s\\\"(?<SAKey>[a-zA-Z0-9+/=]{86}==)\\\",'
# Iterate over all files in the directory matching the pattern
Get-ChildItem -Path $directory -Filter $filePattern -Recurse | ForEach-Object {
# Initialize a hash set to store unique matched keys
$storageAccountKeys = [System.Collections.Generic.HashSet[string]]::new()

$fileContent = Get-Content -Path $_.FullName -Raw
Write-Output $_.FullName
# Find all matches in the file content
$matches = [regex]::Matches($fileContent, $pattern)

$shouldContinue = $false
# Extract and store the keys
foreach ($match in $matches) {
$storageAccountKeys.Add($match.Groups["SAKey"].Value) | Out-Null
$shouldContinue = $true
}
# Print each unique matched key
foreach ($key in $storageAccountKeys) {
Write-Output $key
}
if($shouldContinue)
{
# Replace all matches in the file content with *REDACTED*
$modifiedContent = [regex]::Replace($fileContent, $pattern, '\"value\": \"*REDACTED*\",')

# Save the modified content back to the file
Set-Content -Path $_.FullName -Value $modifiedContent -Force
}
}

# Print a message indicating completion
Write-Output "All keys have been replaced with *REDACTED* in the specified files."

Original file line number Diff line number Diff line change
Expand Up @@ -693,5 +693,10 @@ public IConnectionPoint GetStableVersionDeepGcConnectionPoint()
{
throw new NotImplementedException();
}

public int ResetServerCertificateSettingsRegistry()
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ namespace Microsoft.Azure.Commands.StorageSync.Test.Common
{
internal class MockServerManagedIdentityProvider : IServerManagedIdentityProvider
{
/// <summary>
/// Gets the name of the test.
/// </summary>
/// <value>The name of the test.</value>
protected string TestName;

public MockServerManagedIdentityProvider(string testName)
{
this.TestName = testName;
}

public bool EnableMIChecking { get; set; }

public Guid GetServerApplicationId(LocalServerType serverType, bool throwIfNotFound = true, bool validateSystemAssignedManagedIdentity = true)
Expand All @@ -20,6 +31,10 @@ public Guid GetServerApplicationId(LocalServerType serverType, bool throwIfNotFo

public LocalServerType GetServerType(IEcsManagement ecsManagement)
{
if(TestName == "TestPatchRegisteredServer")
{
return LocalServerType.ArcEnabledHybridServer;
}
return LocalServerType.HybridServer;
}
}
Expand Down
Loading
Loading