diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/AuthorizationManagementClient.cs b/src/StorageSync/StorageSync.Helpers/Authorization/AuthorizationManagementClient.cs
new file mode 100644
index 000000000000..0daf1ea1c40f
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/AuthorizationManagementClient.cs
@@ -0,0 +1,341 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using System.Linq;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// Role based access control provides you a way to apply granular level policy
+ /// administration down to individual resources or resource groups. These
+ /// operations allow you to manage role definitions. A role definition
+ /// describes the set of actions that can be performed on resources.
+ ///
+ public partial class AuthorizationManagementClient : Microsoft.Rest.ServiceClient, IAuthorizationManagementClient, IAzureClient
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ public System.Uri BaseUri { get; set; }
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; }
+
+ ///
+ /// The ID of the target subscription.
+ ///
+ public string SubscriptionId { get; set;}
+
+ ///
+ /// The preferred language for the response.
+ ///
+ public string AcceptLanguage { get; set;}
+
+ ///
+ /// The retry timeout in seconds for Long Running Operations. Default
+ /// /// value is 30.
+ ///
+ public int? LongRunningOperationRetryTimeout { get; set;}
+
+ ///
+ /// Whether a unique x-ms-client-request-id should be generated. When
+ /// /// set to true a unique x-ms-client-request-id value is generated and
+ /// /// included in each request. Default is true.
+ ///
+ public bool? GenerateClientRequestId { get; set;}
+
+ ///
+ /// Gets the IRoleDefinitionsOperations
+ ///
+ public virtual IRoleDefinitionsOperations RoleDefinitions { get; private set; }
+ ///
+ /// Gets the IRoleAssignmentsOperations
+ ///
+ public virtual IRoleAssignmentsOperations RoleAssignments { get; private set; }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling AuthorizationManagementClient.Dispose(). False: will not dispose provided httpClient
+ protected AuthorizationManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
+ {
+ this.Initialize();
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected AuthorizationManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers)
+ {
+ this.Initialize();
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected AuthorizationManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ {
+ this.Initialize();
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ protected AuthorizationManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ this.BaseUri = baseUri;
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ protected AuthorizationManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+
+ this.BaseUri = baseUri;
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public AuthorizationManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ this.Credentials = credentials;
+ if (this.Credentials != null)
+ {
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling AuthorizationManagementClient.Dispose(). False: will not dispose provided httpClient
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public AuthorizationManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ this.Credentials = credentials;
+ if (this.Credentials != null)
+ {
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public AuthorizationManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ this.Credentials = credentials;
+ if (this.Credentials != null)
+ {
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public AuthorizationManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ this.BaseUri = baseUri;
+ this.Credentials = credentials;
+ if (this.Credentials != null)
+ {
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ }
+ ///
+ /// Initializes a new instance of the AuthorizationManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public AuthorizationManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ this.BaseUri = baseUri;
+ this.Credentials = credentials;
+ if (this.Credentials != null)
+ {
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ }
+ ///
+ /// An optional partial-method to perform custom initialization.
+ ///
+ partial void CustomInitialize();
+
+ ///
+ /// Initializes client properties.
+ ///
+ private void Initialize()
+ {
+ this.RoleDefinitions = new RoleDefinitionsOperations(this);
+ this.RoleAssignments = new RoleAssignmentsOperations(this);
+ this.BaseUri = new System.Uri("https://management.azure.com");
+ this.AcceptLanguage = "en-US";
+ this.LongRunningOperationRetryTimeout = 30;
+ this.GenerateClientRequestId = true;
+ SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ {
+ Formatting = Newtonsoft.Json.Formatting.Indented,
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
+ Converters = new System.Collections.Generic.List
+ {
+ new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
+ }
+ };
+ SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter());
+ DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ {
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
+ Converters = new System.Collections.Generic.List
+ {
+ new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
+ }
+ };
+ CustomInitialize();
+ DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter());
+ DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/IAuthorizationManagementClient.cs b/src/StorageSync/StorageSync.Helpers/Authorization/IAuthorizationManagementClient.cs
new file mode 100644
index 000000000000..e0cfa655da88
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/IAuthorizationManagementClient.cs
@@ -0,0 +1,79 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// Role based access control provides you a way to apply granular level policy
+ /// administration down to individual resources or resource groups. These
+ /// operations allow you to manage role definitions. A role definition
+ /// describes the set of actions that can be performed on resources.
+ ///
+ public partial interface IAuthorizationManagementClient : System.IDisposable
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ Microsoft.Rest.ServiceClientCredentials Credentials { get;}
+
+
+ ///
+ /// The ID of the target subscription.
+ ///
+ string SubscriptionId { get; set;}
+
+
+ ///
+ /// The preferred language for the response.
+ ///
+ string AcceptLanguage { get; set;}
+
+
+ ///
+ /// The retry timeout in seconds for Long Running Operations. Default
+ /// /// value is 30.
+ ///
+ int? LongRunningOperationRetryTimeout { get; set;}
+
+
+ ///
+ /// Whether a unique x-ms-client-request-id should be generated. When
+ /// /// set to true a unique x-ms-client-request-id value is generated and
+ /// /// included in each request. Default is true.
+ ///
+ bool? GenerateClientRequestId { get; set;}
+
+
+ ///
+ /// Gets the IRoleDefinitionsOperations
+ ///
+ IRoleDefinitionsOperations RoleDefinitions { get; }
+
+ ///
+ /// Gets the IRoleAssignmentsOperations
+ ///
+ IRoleAssignmentsOperations RoleAssignments { get; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/IRoleAssignmentsOperations.cs b/src/StorageSync/StorageSync.Helpers/Authorization/IRoleAssignmentsOperations.cs
new file mode 100644
index 000000000000..fb65f5a08ac2
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/IRoleAssignmentsOperations.cs
@@ -0,0 +1,145 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// RoleAssignmentsOperations operations.
+ ///
+ public partial interface IRoleAssignmentsOperations
+ {
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of the resource provider.
+ ///
+ ///
+ /// The resource type name. For example the type name of a web app is 'sites'
+ /// (from Microsoft.Web/sites).
+ ///
+ ///
+ /// The resource name.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ System.Threading.Tasks.Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string tenantId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+
+ ///
+ /// Create or update a role assignment by scope and name.
+ ///
+ ///
+ /// Create or update a role assignment by scope and name.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// Parameters for the role assignment.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+
+ ///
+ /// Delete a role assignment by scope and name.
+ ///
+ ///
+ /// Delete a role assignment by scope and name.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ System.Threading.Tasks.Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/IRoleDefinitionsOperations.cs b/src/StorageSync/StorageSync.Helpers/Authorization/IRoleDefinitionsOperations.cs
new file mode 100644
index 000000000000..63b1964379a7
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/IRoleDefinitionsOperations.cs
@@ -0,0 +1,70 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// RoleDefinitionsOperations operations.
+ ///
+ public partial interface IRoleDefinitionsOperations
+ {
+ ///
+ /// Get role definition by name (GUID).
+ ///
+ ///
+ /// Get role definition by name (GUID).
+ ///
+ ///
+ /// The scope of the role definition.
+ ///
+ ///
+ /// The ID of the role definition.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string scope, string roleDefinitionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+
+ ///
+ /// Gets a role definition by ID.
+ ///
+ ///
+ /// Gets a role definition by ID.
+ ///
+ ///
+ /// The fully qualified role definition ID. Use the format,
+ /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
+ /// for subscription level role definitions, or
+ /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
+ /// tenant level role definitions.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string roleId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorAdditionalInfo.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorAdditionalInfo.cs
new file mode 100644
index 000000000000..47af23dcf424
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorAdditionalInfo.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// The resource management error additional info.
+ ///
+ public partial class ErrorAdditionalInfo
+ {
+ ///
+ /// Initializes a new instance of the ErrorAdditionalInfo class.
+ ///
+ public ErrorAdditionalInfo()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorAdditionalInfo class.
+ ///
+
+ /// The additional info type.
+ ///
+
+ /// The additional info.
+ ///
+ public ErrorAdditionalInfo(string type = default(string), object info = default(object))
+
+ {
+ this.Type = type;
+ this.Info = info;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets the additional info type.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "type")]
+ public string Type {get; private set; }
+
+ ///
+ /// Gets the additional info.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "info")]
+ public object Info {get; private set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorDetail.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorDetail.cs
new file mode 100644
index 000000000000..9fd3d715ef68
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorDetail.cs
@@ -0,0 +1,88 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// The error detail.
+ ///
+ public partial class ErrorDetail
+ {
+ ///
+ /// Initializes a new instance of the ErrorDetail class.
+ ///
+ public ErrorDetail()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorDetail class.
+ ///
+
+ /// The error code.
+ ///
+
+ /// The error message.
+ ///
+
+ /// The error target.
+ ///
+
+ /// The error details.
+ ///
+
+ /// The error additional info.
+ ///
+ public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), System.Collections.Generic.IList details = default(System.Collections.Generic.IList), System.Collections.Generic.IList additionalInfo = default(System.Collections.Generic.IList))
+
+ {
+ this.Code = code;
+ this.Message = message;
+ this.Target = target;
+ this.Details = details;
+ this.AdditionalInfo = additionalInfo;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets the error code.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "code")]
+ public string Code {get; private set; }
+
+ ///
+ /// Gets the error message.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "message")]
+ public string Message {get; private set; }
+
+ ///
+ /// Gets the error target.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "target")]
+ public string Target {get; private set; }
+
+ ///
+ /// Gets the error details.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "details")]
+ public System.Collections.Generic.IList Details {get; private set; }
+
+ ///
+ /// Gets the error additional info.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "additionalInfo")]
+ public System.Collections.Generic.IList AdditionalInfo {get; private set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorResponse.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorResponse.cs
new file mode 100644
index 000000000000..113d61cb2114
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorResponse.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Common error response for all Azure Resource Manager APIs to return error
+ /// details for failed operations. (This also follows the OData error response
+ /// format.).
+ ///
+ ///
+ /// Common error response for all Azure Resource Manager APIs to return error
+ /// details for failed operations. (This also follows the OData error response
+ /// format.).
+ ///
+ public partial class ErrorResponse
+ {
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ public ErrorResponse()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+
+ /// The error object.
+ ///
+ public ErrorResponse(ErrorDetail error = default(ErrorDetail))
+
+ {
+ this.Error = error;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets or sets the error object.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "error")]
+ public ErrorDetail Error {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorResponseException.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorResponseException.cs
new file mode 100644
index 000000000000..f6dd01a31724
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/ErrorResponseException.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+
+ ///
+ /// Exception thrown for an invalid response with ErrorResponse information.
+ ///
+ public partial class ErrorResponseException : Microsoft.Rest.RestException
+ {
+ ///
+ /// Gets information about the associated HTTP request.
+ ///
+ public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; }
+
+ ///
+ /// Gets information about the associated HTTP response.
+ ///
+ public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; }
+
+ ///
+ /// Gets or sets the body object.
+ ///
+ public ErrorResponse Body { get; set; }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ public ErrorResponseException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ /// The exception message.
+ public ErrorResponseException(string message)
+ : this(message, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ /// The exception message.
+ /// Inner exception.
+ public ErrorResponseException(string message, System.Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/Page.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/Page.cs
new file mode 100644
index 000000000000..4c2e119275cd
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/Page.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+
+ ///
+ /// Defines a page in Azure responses.
+ ///
+ /// Type of the page content items
+ [Newtonsoft.Json.JsonObject]
+ public class Page : Microsoft.Rest.Azure.IPage
+ {
+ ///
+ /// Gets the link to the next page.
+ ///
+ [Newtonsoft.Json.JsonProperty("nextLink")]
+ public System.String NextPageLink { get; private set; }
+
+ [Newtonsoft.Json.JsonProperty("value")]
+ private System.Collections.Generic.IList Items{ get; set; }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ public System.Collections.Generic.IEnumerator GetEnumerator()
+ {
+ return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/Permission.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/Permission.cs
new file mode 100644
index 000000000000..f33124e0a105
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/Permission.cs
@@ -0,0 +1,78 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role definition permissions.
+ ///
+ public partial class Permission
+ {
+ ///
+ /// Initializes a new instance of the Permission class.
+ ///
+ public Permission()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Permission class.
+ ///
+
+ /// Allowed actions.
+ ///
+
+ /// Denied actions.
+ ///
+
+ /// Allowed Data actions.
+ ///
+
+ /// Denied Data actions.
+ ///
+ public Permission(System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.Collections.Generic.IList notActions = default(System.Collections.Generic.IList), System.Collections.Generic.IList dataActions = default(System.Collections.Generic.IList), System.Collections.Generic.IList notDataActions = default(System.Collections.Generic.IList))
+
+ {
+ this.Actions = actions;
+ this.NotActions = notActions;
+ this.DataActions = dataActions;
+ this.NotDataActions = notDataActions;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets or sets allowed actions.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "actions")]
+ public System.Collections.Generic.IList Actions {get; set; }
+
+ ///
+ /// Gets or sets denied actions.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "notActions")]
+ public System.Collections.Generic.IList NotActions {get; set; }
+
+ ///
+ /// Gets or sets allowed Data actions.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "dataActions")]
+ public System.Collections.Generic.IList DataActions {get; set; }
+
+ ///
+ /// Gets or sets denied Data actions.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "notDataActions")]
+ public System.Collections.Generic.IList NotDataActions {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/PrincipalType.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/PrincipalType.cs
new file mode 100644
index 000000000000..085e6b2b5127
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/PrincipalType.cs
@@ -0,0 +1,27 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+
+ ///
+ /// Defines values for PrincipalType.
+ ///
+
+
+ public static class PrincipalType
+ {
+ public const string User = "User";
+ public const string Group = "Group";
+ public const string ServicePrincipal = "ServicePrincipal";
+ public const string Unknown = "Unknown";
+ public const string DirectoryRoleTemplate = "DirectoryRoleTemplate";
+ public const string ForeignGroup = "ForeignGroup";
+ public const string Application = "Application";
+ public const string MSI = "MSI";
+ public const string DirectoryObjectOrGroup = "DirectoryObjectOrGroup";
+ public const string Everyone = "Everyone";
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignment.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignment.cs
new file mode 100644
index 000000000000..bdefe795af56
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignment.cs
@@ -0,0 +1,197 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role Assignments
+ ///
+ [Microsoft.Rest.Serialization.JsonTransformation]
+ public partial class RoleAssignment : Microsoft.Rest.Azure.IResource
+ {
+ ///
+ /// Initializes a new instance of the RoleAssignment class.
+ ///
+ public RoleAssignment()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleAssignment class.
+ ///
+
+ /// The role assignment ID.
+ ///
+
+ /// The role assignment name.
+ ///
+
+ /// The role assignment type.
+ ///
+
+ /// The principal type of the assigned principal ID.
+ /// Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown',
+ /// 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI',
+ /// 'DirectoryObjectOrGroup', 'Everyone'
+
+ /// The role assignment scope.
+ ///
+
+ /// The role definition ID.
+ ///
+
+ /// The principal ID.
+ ///
+
+ /// Description of role assignment
+ ///
+
+ /// The conditions on the role assignment. This limits the resources it can be
+ /// assigned to. e.g.:
+ /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
+ /// StringEqualsIgnoreCase 'foo_storage_container'
+ ///
+
+ /// Version of the condition. Currently accepted value is '2.0'
+ ///
+
+ /// Time it was created
+ ///
+
+ /// Time it was updated
+ ///
+
+ /// Id of the user who created the assignment
+ ///
+
+ /// Id of the user who updated the assignment
+ ///
+
+ /// Id of the delegated managed identity resource
+ ///
+ public RoleAssignment(string id = default(string), string name = default(string), string type = default(string), string principalType = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string description = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), string createdBy = default(string), string updatedBy = default(string), string delegatedManagedIdentityResourceId = default(string))
+
+ {
+ this.Id = id;
+ this.Name = name;
+ this.Type = type;
+ this.PrincipalType = principalType;
+ this.Scope = scope;
+ this.RoleDefinitionId = roleDefinitionId;
+ this.PrincipalId = principalId;
+ this.Description = description;
+ this.Condition = condition;
+ this.ConditionVersion = conditionVersion;
+ this.CreatedOn = createdOn;
+ this.UpdatedOn = updatedOn;
+ this.CreatedBy = createdBy;
+ this.UpdatedBy = updatedBy;
+ this.DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets the role assignment ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "id")]
+ public string Id {get; private set; }
+
+ ///
+ /// Gets the role assignment name.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "name")]
+ public string Name {get; private set; }
+
+ ///
+ /// Gets the role assignment type.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "type")]
+ public string Type {get; private set; }
+
+ ///
+ /// Gets or sets the principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalType")]
+ public string PrincipalType {get; set; }
+
+ ///
+ /// Gets the role assignment scope.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scope")]
+ public string Scope {get; private set; }
+
+ ///
+ /// Gets or sets the role definition ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleDefinitionId")]
+ public string RoleDefinitionId {get; set; }
+
+ ///
+ /// Gets or sets the principal ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalId")]
+ public string PrincipalId {get; set; }
+
+ ///
+ /// Gets or sets description of role assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")]
+ public string Description {get; set; }
+
+ ///
+ /// Gets or sets the conditions on the role assignment. This limits the
+ /// resources it can be assigned to. e.g.:
+ /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
+ /// StringEqualsIgnoreCase 'foo_storage_container'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.condition")]
+ public string Condition {get; set; }
+
+ ///
+ /// Gets or sets version of the condition. Currently accepted value is '2.0'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.conditionVersion")]
+ public string ConditionVersion {get; set; }
+
+ ///
+ /// Gets time it was created
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdOn")]
+ public System.DateTime? CreatedOn {get; private set; }
+
+ ///
+ /// Gets time it was updated
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.updatedOn")]
+ public System.DateTime? UpdatedOn {get; private set; }
+
+ ///
+ /// Gets id of the user who created the assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdBy")]
+ public string CreatedBy {get; private set; }
+
+ ///
+ /// Gets id of the user who updated the assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.updatedBy")]
+ public string UpdatedBy {get; private set; }
+
+ ///
+ /// Gets or sets id of the delegated managed identity resource
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.delegatedManagedIdentityResourceId")]
+ public string DelegatedManagedIdentityResourceId {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentCreateParameters.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentCreateParameters.cs
new file mode 100644
index 000000000000..0b9fcce822bc
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentCreateParameters.cs
@@ -0,0 +1,194 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role assignment create parameters.
+ ///
+ [Microsoft.Rest.Serialization.JsonTransformation]
+ public partial class RoleAssignmentCreateParameters
+ {
+ ///
+ /// Initializes a new instance of the RoleAssignmentCreateParameters class.
+ ///
+ public RoleAssignmentCreateParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleAssignmentCreateParameters class.
+ ///
+
+ /// The principal type of the assigned principal ID.
+ /// Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown',
+ /// 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI',
+ /// 'DirectoryObjectOrGroup', 'Everyone'
+
+ /// The role assignment scope.
+ ///
+
+ /// The role definition ID.
+ ///
+
+ /// The principal ID.
+ ///
+
+ /// Description of role assignment
+ ///
+
+ /// The conditions on the role assignment. This limits the resources it can be
+ /// assigned to. e.g.:
+ /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
+ /// StringEqualsIgnoreCase 'foo_storage_container'
+ ///
+
+ /// Version of the condition. Currently accepted value is '2.0'
+ ///
+
+ /// Time it was created
+ ///
+
+ /// Time it was updated
+ ///
+
+ /// Id of the user who created the assignment
+ ///
+
+ /// Id of the user who updated the assignment
+ ///
+
+ /// Id of the delegated managed identity resource
+ ///
+ public RoleAssignmentCreateParameters(string roleDefinitionId, string principalId, string principalType = default(string), string scope = default(string), string description = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), string createdBy = default(string), string updatedBy = default(string), string delegatedManagedIdentityResourceId = default(string))
+
+ {
+ this.PrincipalType = principalType;
+ this.Scope = scope;
+ this.RoleDefinitionId = roleDefinitionId;
+ this.PrincipalId = principalId;
+ this.Description = description;
+ this.Condition = condition;
+ this.ConditionVersion = conditionVersion;
+ this.CreatedOn = createdOn;
+ this.UpdatedOn = updatedOn;
+ this.CreatedBy = createdBy;
+ this.UpdatedBy = updatedBy;
+ this.DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets or sets the principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalType")]
+ public string PrincipalType {get; set; }
+
+ ///
+ /// Gets the role assignment scope.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scope")]
+ public string Scope {get; private set; }
+
+ ///
+ /// Gets or sets the role definition ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleDefinitionId")]
+ public string RoleDefinitionId {get; set; }
+
+ ///
+ /// Gets or sets the principal ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalId")]
+ public string PrincipalId {get; set; }
+
+ ///
+ /// Gets or sets description of role assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")]
+ public string Description {get; set; }
+
+ ///
+ /// Gets or sets the conditions on the role assignment. This limits the
+ /// resources it can be assigned to. e.g.:
+ /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
+ /// StringEqualsIgnoreCase 'foo_storage_container'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.condition")]
+ public string Condition {get; set; }
+
+ ///
+ /// Gets or sets version of the condition. Currently accepted value is '2.0'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.conditionVersion")]
+ public string ConditionVersion {get; set; }
+
+ ///
+ /// Gets time it was created
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdOn")]
+ public System.DateTime? CreatedOn {get; private set; }
+
+ ///
+ /// Gets time it was updated
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.updatedOn")]
+ public System.DateTime? UpdatedOn {get; private set; }
+
+ ///
+ /// Gets id of the user who created the assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdBy")]
+ public string CreatedBy {get; private set; }
+
+ ///
+ /// Gets id of the user who updated the assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.updatedBy")]
+ public string UpdatedBy {get; private set; }
+
+ ///
+ /// Gets or sets id of the delegated managed identity resource
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.delegatedManagedIdentityResourceId")]
+ public string DelegatedManagedIdentityResourceId {get; set; }
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (this.RoleDefinitionId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RoleDefinitionId");
+ }
+ if (this.PrincipalId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PrincipalId");
+ }
+
+
+
+
+
+
+
+
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentFilter.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentFilter.cs
new file mode 100644
index 000000000000..9e53e2b7b724
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentFilter.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role Assignments filter
+ ///
+ public partial class RoleAssignmentFilter
+ {
+ ///
+ /// Initializes a new instance of the RoleAssignmentFilter class.
+ ///
+ public RoleAssignmentFilter()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleAssignmentFilter class.
+ ///
+
+ /// Returns role assignment of the specific principal.
+ ///
+ public RoleAssignmentFilter(string principalId = default(string))
+
+ {
+ this.PrincipalId = principalId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets or sets returns role assignment of the specific principal.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")]
+ public string PrincipalId {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentProperties.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentProperties.cs
new file mode 100644
index 000000000000..4e7272211de5
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleAssignmentProperties.cs
@@ -0,0 +1,193 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role assignment properties.
+ ///
+ public partial class RoleAssignmentProperties
+ {
+ ///
+ /// Initializes a new instance of the RoleAssignmentProperties class.
+ ///
+ public RoleAssignmentProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleAssignmentProperties class.
+ ///
+
+ /// The role assignment scope.
+ ///
+
+ /// The role definition ID.
+ ///
+
+ /// The principal ID.
+ ///
+
+ /// The principal type of the assigned principal ID.
+ /// Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown',
+ /// 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI',
+ /// 'DirectoryObjectOrGroup', 'Everyone'
+
+ /// Description of role assignment
+ ///
+
+ /// The conditions on the role assignment. This limits the resources it can be
+ /// assigned to. e.g.:
+ /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
+ /// StringEqualsIgnoreCase 'foo_storage_container'
+ ///
+
+ /// Version of the condition. Currently accepted value is '2.0'
+ ///
+
+ /// Time it was created
+ ///
+
+ /// Time it was updated
+ ///
+
+ /// Id of the user who created the assignment
+ ///
+
+ /// Id of the user who updated the assignment
+ ///
+
+ /// Id of the delegated managed identity resource
+ ///
+ public RoleAssignmentProperties(string roleDefinitionId, string principalId, string scope = default(string), string principalType = default(string), string description = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), string createdBy = default(string), string updatedBy = default(string), string delegatedManagedIdentityResourceId = default(string))
+
+ {
+ this.Scope = scope;
+ this.RoleDefinitionId = roleDefinitionId;
+ this.PrincipalId = principalId;
+ this.PrincipalType = principalType;
+ this.Description = description;
+ this.Condition = condition;
+ this.ConditionVersion = conditionVersion;
+ this.CreatedOn = createdOn;
+ this.UpdatedOn = updatedOn;
+ this.CreatedBy = createdBy;
+ this.UpdatedBy = updatedBy;
+ this.DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets the role assignment scope.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "scope")]
+ public string Scope {get; private set; }
+
+ ///
+ /// Gets or sets the role definition ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "roleDefinitionId")]
+ public string RoleDefinitionId {get; set; }
+
+ ///
+ /// Gets or sets the principal ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")]
+ public string PrincipalId {get; set; }
+
+ ///
+ /// Gets or sets the principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "principalType")]
+ public string PrincipalType {get; set; }
+
+ ///
+ /// Gets or sets description of role assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "description")]
+ public string Description {get; set; }
+
+ ///
+ /// Gets or sets the conditions on the role assignment. This limits the
+ /// resources it can be assigned to. e.g.:
+ /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
+ /// StringEqualsIgnoreCase 'foo_storage_container'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "condition")]
+ public string Condition {get; set; }
+
+ ///
+ /// Gets or sets version of the condition. Currently accepted value is '2.0'
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "conditionVersion")]
+ public string ConditionVersion {get; set; }
+
+ ///
+ /// Gets time it was created
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "createdOn")]
+ public System.DateTime? CreatedOn {get; private set; }
+
+ ///
+ /// Gets time it was updated
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "updatedOn")]
+ public System.DateTime? UpdatedOn {get; private set; }
+
+ ///
+ /// Gets id of the user who created the assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "createdBy")]
+ public string CreatedBy {get; private set; }
+
+ ///
+ /// Gets id of the user who updated the assignment
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "updatedBy")]
+ public string UpdatedBy {get; private set; }
+
+ ///
+ /// Gets or sets id of the delegated managed identity resource
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "delegatedManagedIdentityResourceId")]
+ public string DelegatedManagedIdentityResourceId {get; set; }
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (this.RoleDefinitionId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RoleDefinitionId");
+ }
+ if (this.PrincipalId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PrincipalId");
+ }
+
+
+
+
+
+
+
+
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinition.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinition.cs
new file mode 100644
index 000000000000..3777f1b2fe2d
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinition.cs
@@ -0,0 +1,119 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role definition.
+ ///
+ [Microsoft.Rest.Serialization.JsonTransformation]
+ public partial class RoleDefinition
+ {
+ ///
+ /// Initializes a new instance of the RoleDefinition class.
+ ///
+ public RoleDefinition()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleDefinition class.
+ ///
+
+ /// The role definition ID.
+ ///
+
+ /// The role definition name.
+ ///
+
+ /// The role definition type.
+ ///
+
+ /// The role name.
+ ///
+
+ /// The role definition description.
+ ///
+
+ /// The role type.
+ ///
+
+ /// Role definition permissions.
+ ///
+
+ /// Role definition assignable scopes.
+ ///
+ public RoleDefinition(string id = default(string), string name = default(string), string type = default(string), string roleName = default(string), string description = default(string), string roleType = default(string), System.Collections.Generic.IList permissions = default(System.Collections.Generic.IList), System.Collections.Generic.IList assignableScopes = default(System.Collections.Generic.IList))
+
+ {
+ this.Id = id;
+ this.Name = name;
+ this.Type = type;
+ this.RoleName = roleName;
+ this.Description = description;
+ this.RoleType = roleType;
+ this.Permissions = permissions;
+ this.AssignableScopes = assignableScopes;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets the role definition ID.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "id")]
+ public string Id {get; private set; }
+
+ ///
+ /// Gets the role definition name.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "name")]
+ public string Name {get; private set; }
+
+ ///
+ /// Gets the role definition type.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "type")]
+ public string Type {get; private set; }
+
+ ///
+ /// Gets or sets the role name.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleName")]
+ public string RoleName {get; set; }
+
+ ///
+ /// Gets or sets the role definition description.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")]
+ public string Description {get; set; }
+
+ ///
+ /// Gets or sets the role type.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.type")]
+ public string RoleType {get; set; }
+
+ ///
+ /// Gets or sets role definition permissions.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.permissions")]
+ public System.Collections.Generic.IList Permissions {get; set; }
+
+ ///
+ /// Gets or sets role definition assignable scopes.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "properties.assignableScopes")]
+ public System.Collections.Generic.IList AssignableScopes {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinitionFilter.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinitionFilter.cs
new file mode 100644
index 000000000000..3a06c62a6ce5
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinitionFilter.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role Definitions filter
+ ///
+ public partial class RoleDefinitionFilter
+ {
+ ///
+ /// Initializes a new instance of the RoleDefinitionFilter class.
+ ///
+ public RoleDefinitionFilter()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleDefinitionFilter class.
+ ///
+
+ /// Returns role definition with the specific name.
+ ///
+
+ /// Returns role definition with the specific type.
+ ///
+ public RoleDefinitionFilter(string roleName = default(string), string type = default(string))
+
+ {
+ this.RoleName = roleName;
+ this.Type = type;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets or sets returns role definition with the specific name.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "roleName")]
+ public string RoleName {get; set; }
+
+ ///
+ /// Gets or sets returns role definition with the specific type.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "type")]
+ public string Type {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinitionProperties.cs b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinitionProperties.cs
new file mode 100644
index 000000000000..f408180eaaaa
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/Models/RoleDefinitionProperties.cs
@@ -0,0 +1,88 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using System.Linq;
+
+ ///
+ /// Role definition properties.
+ ///
+ public partial class RoleDefinitionProperties
+ {
+ ///
+ /// Initializes a new instance of the RoleDefinitionProperties class.
+ ///
+ public RoleDefinitionProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RoleDefinitionProperties class.
+ ///
+
+ /// The role name.
+ ///
+
+ /// The role definition description.
+ ///
+
+ /// The role type.
+ ///
+
+ /// Role definition permissions.
+ ///
+
+ /// Role definition assignable scopes.
+ ///
+ public RoleDefinitionProperties(string roleName = default(string), string description = default(string), string roleType = default(string), System.Collections.Generic.IList permissions = default(System.Collections.Generic.IList), System.Collections.Generic.IList assignableScopes = default(System.Collections.Generic.IList))
+
+ {
+ this.RoleName = roleName;
+ this.Description = description;
+ this.RoleType = roleType;
+ this.Permissions = permissions;
+ this.AssignableScopes = assignableScopes;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+
+ ///
+ /// Gets or sets the role name.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "roleName")]
+ public string RoleName {get; set; }
+
+ ///
+ /// Gets or sets the role definition description.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "description")]
+ public string Description {get; set; }
+
+ ///
+ /// Gets or sets the role type.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "type")]
+ public string RoleType {get; set; }
+
+ ///
+ /// Gets or sets role definition permissions.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "permissions")]
+ public System.Collections.Generic.IList Permissions {get; set; }
+
+ ///
+ /// Gets or sets role definition assignable scopes.
+ ///
+ [Newtonsoft.Json.JsonProperty(PropertyName = "assignableScopes")]
+ public System.Collections.Generic.IList AssignableScopes {get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/RoleAssignmentsOperations.cs b/src/StorageSync/StorageSync.Helpers/Authorization/RoleAssignmentsOperations.cs
new file mode 100644
index 000000000000..c947159cdc7a
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/RoleAssignmentsOperations.cs
@@ -0,0 +1,934 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using System.Linq;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// RoleAssignmentsOperations operations.
+ ///
+ internal partial class RoleAssignmentsOperations : Microsoft.Rest.IServiceOperations, IRoleAssignmentsOperations
+ {
+ ///
+ /// Initializes a new instance of the RoleAssignmentsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal RoleAssignmentsOperations (AuthorizationManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ this.Client = client;
+ }
+
+ ///
+ /// Gets a reference to the AuthorizationManagementClient
+ ///
+ public AuthorizationManagementClient Client { get; private set; }
+
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of the resource provider.
+ ///
+ ///
+ /// The resource type name. For example the type name of a web app is 'sites'
+ /// (from Microsoft.Web/sites).
+ ///
+ ///
+ /// The resource name.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async System.Threading.Tasks.Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string tenantId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+
+
+
+
+
+ if (this.Client.SubscriptionId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (this.Client.SubscriptionId != null)
+ {
+ if (this.Client.SubscriptionId.Length < 1)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (resourceProviderNamespace == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace");
+ }
+
+ if (resourceType == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType");
+ }
+
+ if (resourceName == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName");
+ }
+
+
+ string apiVersion = "2020-08-01-preview";
+ // Tracing
+ bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
+ System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ tracingParameters.Add("odataQuery", odataQuery);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
+ tracingParameters.Add("resourceType", resourceType);
+ tracingParameters.Add("resourceName", resourceName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("tenantId", tenantId);
+
+
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListForResource", tracingParameters);
+ }
+ // Construct URL
+
+ var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{resourceProviderNamespace}", resourceProviderNamespace);
+ _url = _url.Replace("{resourceType}", resourceType);
+ _url = _url.Replace("{resourceName}", resourceName);
+
+ System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ if (odataQuery != null)
+ {
+ var _roleAssignmentFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_roleAssignmentFilter))
+ {
+ _queryParameters.Add(_roleAssignmentFilter);
+ }
+ }
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (tenantId != null)
+ {
+ _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+
+ System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (Newtonsoft.Json.JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+
+
+
+
+
+ }
+ ///
+ /// Create or update a role assignment by scope and name.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// Parameters for the role assignment.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+
+
+
+
+ if (parameters == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ if (scope == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope");
+ }
+
+ if (roleAssignmentName == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "roleAssignmentName");
+ }
+
+ string apiVersion = "2020-08-01-preview";
+ // Tracing
+ bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
+ System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("roleAssignmentName", roleAssignmentName);
+ tracingParameters.Add("apiVersion", apiVersion);
+
+ tracingParameters.Add("parameters", parameters);
+
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters);
+ }
+ // Construct URL
+
+ var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{roleAssignmentName}", roleAssignmentName);
+
+ System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings);
+ _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+
+ System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (Newtonsoft.Json.JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+
+
+
+
+
+ }
+ ///
+ /// Delete a role assignment by scope and name.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+
+
+
+
+ if (scope == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope");
+ }
+
+ if (roleAssignmentName == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "roleAssignmentName");
+ }
+
+
+ string apiVersion = "2020-08-01-preview";
+ // Tracing
+ bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
+ System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("roleAssignmentName", roleAssignmentName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("tenantId", tenantId);
+
+
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+
+ var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{roleAssignmentName}", roleAssignmentName);
+
+ System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (tenantId != null)
+ {
+ _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+
+ System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+
+ if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (Newtonsoft.Json.JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+
+
+
+
+
+ }
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async System.Threading.Tasks.Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+
+ if (nextPageLink == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
+ System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+
+
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListForResourceNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+
+ System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+
+ System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (Newtonsoft.Json.JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+
+
+
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/RoleAssignmentsOperationsExtensions.cs b/src/StorageSync/StorageSync.Helpers/Authorization/RoleAssignmentsOperationsExtensions.cs
new file mode 100644
index 000000000000..4af48d9728f4
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/RoleAssignmentsOperationsExtensions.cs
@@ -0,0 +1,214 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// Extension methods for RoleAssignmentsOperations
+ ///
+ public static partial class RoleAssignmentsOperationsExtensions
+ {
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of the resource provider.
+ ///
+ ///
+ /// The resource type name. For example the type name of a web app is 'sites'
+ /// (from Microsoft.Web/sites).
+ ///
+ ///
+ /// The resource name.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ public static Microsoft.Rest.Azure.IPage ListForResource(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string tenantId = default(string))
+ {
+ return ((IRoleAssignmentsOperations)operations).ListForResourceAsync(resourceGroupName, resourceProviderNamespace, resourceType, resourceName, odataQuery, tenantId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of the resource provider.
+ ///
+ ///
+ /// The resource type name. For example the type name of a web app is 'sites'
+ /// (from Microsoft.Web/sites).
+ ///
+ ///
+ /// The resource name.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async System.Threading.Tasks.Task> ListForResourceAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string tenantId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+ using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, resourceType, resourceName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+ ///
+ /// Create or update a role assignment by scope and name.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters)
+ {
+ return ((IRoleAssignmentsOperations)operations).CreateAsync(scope, roleAssignmentName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create or update a role assignment by scope and name.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async System.Threading.Tasks.Task CreateAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+ using (var _result = await operations.CreateWithHttpMessagesAsync(scope, roleAssignmentName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+ ///
+ /// Delete a role assignment by scope and name.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string))
+ {
+ return ((IRoleAssignmentsOperations)operations).DeleteAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete a role assignment by scope and name.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope of the operation or resource. Valid scopes are: subscription
+ /// (format: '/subscriptions/{subscriptionId}'), resource group (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
+ /// resource (format:
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
+ ///
+ ///
+ /// The name of the role assignment. It can be any valid GUID.
+ ///
+ ///
+ /// Tenant ID for cross-tenant request
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async System.Threading.Tasks.Task DeleteAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+ using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static Microsoft.Rest.Azure.IPage ListForResourceNext(this IRoleAssignmentsOperations operations, string nextPageLink)
+ {
+ return ((IRoleAssignmentsOperations)operations).ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List all role assignments that apply to a resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async System.Threading.Tasks.Task> ListForResourceNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+ using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+ }
+}
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/RoleDefinitionsOperations.cs b/src/StorageSync/StorageSync.Helpers/Authorization/RoleDefinitionsOperations.cs
new file mode 100644
index 000000000000..7f8752eed715
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/RoleDefinitionsOperations.cs
@@ -0,0 +1,434 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using System.Linq;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// RoleDefinitionsOperations operations.
+ ///
+ internal partial class RoleDefinitionsOperations : Microsoft.Rest.IServiceOperations, IRoleDefinitionsOperations
+ {
+ ///
+ /// Initializes a new instance of the RoleDefinitionsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal RoleDefinitionsOperations (AuthorizationManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ this.Client = client;
+ }
+
+ ///
+ /// Gets a reference to the AuthorizationManagementClient
+ ///
+ public AuthorizationManagementClient Client { get; private set; }
+
+ ///
+ /// Get role definition by name (GUID).
+ ///
+ ///
+ /// The scope of the role definition.
+ ///
+ ///
+ /// The ID of the role definition.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string scope, string roleDefinitionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+
+
+
+
+ if (scope == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope");
+ }
+
+ if (roleDefinitionId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "roleDefinitionId");
+ }
+
+ string apiVersion = "2018-01-01-preview";
+ // Tracing
+ bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
+ System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("roleDefinitionId", roleDefinitionId);
+ tracingParameters.Add("apiVersion", apiVersion);
+
+
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+
+ var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId));
+
+ System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+
+ System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (Newtonsoft.Json.JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+
+
+
+
+
+ }
+ ///
+ /// Gets a role definition by ID.
+ ///
+ ///
+ /// The fully qualified role definition ID. Use the format,
+ /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
+ /// for subscription level role definitions, or
+ /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
+ /// tenant level role definitions.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string roleId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+
+
+
+
+ if (roleId == null)
+ {
+ throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "roleId");
+ }
+
+ string apiVersion = "2018-01-01-preview";
+ // Tracing
+ bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
+ System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ tracingParameters.Add("roleId", roleId);
+ tracingParameters.Add("apiVersion", apiVersion);
+
+
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters);
+ }
+ // Construct URL
+
+ var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleId}").ToString();
+ _url = _url.Replace("{roleId}", roleId);
+
+ System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (this.Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ }
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (this.Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+
+ System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (Newtonsoft.Json.JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ }
+ catch (Newtonsoft.Json.JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+
+
+
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/Authorization/RoleDefinitionsOperationsExtensions.cs b/src/StorageSync/StorageSync.Helpers/Authorization/RoleDefinitionsOperationsExtensions.cs
new file mode 100644
index 000000000000..993ef32f11d9
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Authorization/RoleDefinitionsOperationsExtensions.cs
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+{
+ using Microsoft.Rest.Azure;
+ using Models;
+
+ ///
+ /// Extension methods for RoleDefinitionsOperations
+ ///
+ public static partial class RoleDefinitionsOperationsExtensions
+ {
+ ///
+ /// Get role definition by name (GUID).
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope of the role definition.
+ ///
+ ///
+ /// The ID of the role definition.
+ ///
+ public static RoleDefinition Get(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId)
+ {
+ return ((IRoleDefinitionsOperations)operations).GetAsync(scope, roleDefinitionId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get role definition by name (GUID).
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope of the role definition.
+ ///
+ ///
+ /// The ID of the role definition.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async System.Threading.Tasks.Task GetAsync(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleDefinitionId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+ ///
+ /// Gets a role definition by ID.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The fully qualified role definition ID. Use the format,
+ /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
+ /// for subscription level role definitions, or
+ /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
+ /// tenant level role definitions.
+ ///
+ public static RoleDefinition GetById(this IRoleDefinitionsOperations operations, string roleId)
+ {
+ return ((IRoleDefinitionsOperations)operations).GetByIdAsync(roleId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a role definition by ID.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The fully qualified role definition ID. Use the format,
+ /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
+ /// for subscription level role definitions, or
+ /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
+ /// tenant level role definitions.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async System.Threading.Tasks.Task GetByIdAsync(this IRoleDefinitionsOperations operations, string roleId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ {
+ using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+ }
+}
diff --git a/src/StorageSync/StorageSync.Helpers/Customizations/RoleAssignmentFilter.cs b/src/StorageSync/StorageSync.Helpers/Customizations/RoleAssignmentFilter.cs
new file mode 100644
index 000000000000..8f4fc9c9fb66
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Customizations/RoleAssignmentFilter.cs
@@ -0,0 +1,30 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models
+{
+ using Microsoft.Rest.Azure.OData;
+
+ ///
+ /// Role Assignments filter
+ ///
+ public partial class RoleAssignmentFilter
+ {
+ [ODataMethod("atScope")]
+ public bool AtScope()
+ {
+ return true;
+ }
+
+ [ODataMethod("assignedTo")]
+ public bool AssignedTo(string principalId)
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/StorageSync/StorageSync.Helpers/Properties/AssemblyInfo.cs b/src/StorageSync/StorageSync.Helpers/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000000..d43b683517c4
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/Properties/AssemblyInfo.cs
@@ -0,0 +1,28 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Microsoft Azure Powershell - StorageSync Helper - Authorization")]
+[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
+[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
+[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
+
+[assembly: ComVisible(false)]
+[assembly: CLSCompliant(false)]
+[assembly: AssemblyVersion("2.0.0.0")]
+[assembly: AssemblyFileVersion("2.13.0.0")]
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.Helpers/README.md b/src/StorageSync/StorageSync.Helpers/README.md
new file mode 100644
index 000000000000..9f7b3648c82c
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/README.md
@@ -0,0 +1,55 @@
+# Overall
+This directory contains the service clients of other services for Azure PowerShell StorageSync module.
+
+## Run Generation
+In this directory, run AutoRest:
+```
+autorest --use:@autorest/powershell@4.x --tag=authorization
+```
+
+### AutoRest Configuration
+> see https://aka.ms/autorest
+
+``` yaml
+isSdkGenerator: true
+powershell: true
+clear-output-folder: true
+reflect-api-versions: true
+openapi-type: arm
+azure-arm: true
+license-header: MICROSOFT_MIT_NO_VERSION
+```
+
+### Tag: authorization
+``` yaml $(tag) == 'authorization'
+commit: 61e7148e9592c5efc95e5c16a5bb4f2dc26d6de0
+input-file:
+ - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/authorization/resource-manager/Microsoft.Authorization/preview/2018-01-01-preview/authorization-RoleDefinitionsCalls.json
+ - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-08-01-preview/authorization-RoleAssignmentsCalls.json
+
+output-folder: Authorization
+
+namespace: Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization
+
+directive:
+ - remove-operation:
+ - Permissions_ListForResourceGroup
+ - Permissions_ListForResource
+ - RoleDefinitions_Delete
+ - RoleDefinitions_CreateOrUpdate
+ - RoleDefinitions_List
+ - RoleAssignments_ListForSubscription
+ - RoleAssignments_ListForResourceGroup
+ - RoleAssignments_Get
+ - RoleAssignments_Validate
+ - RoleAssignments_ListForScope
+ - RoleAssignments_GetById
+ - RoleAssignments_CreateById
+ - RoleAssignments_DeleteById
+ - RoleAssignments_ValidateById
+ - remove-model:
+ - PermissionGetResult
+ - ValidationResponseErrorInfo
+ - ValidationResponse
+ - RoleDefinitionListResult
+```
diff --git a/src/StorageSync/StorageSync.Helpers/StorageSync.Helper.csproj b/src/StorageSync/StorageSync.Helpers/StorageSync.Helper.csproj
new file mode 100644
index 000000000000..7169c87156b6
--- /dev/null
+++ b/src/StorageSync/StorageSync.Helpers/StorageSync.Helper.csproj
@@ -0,0 +1,13 @@
+
+
+ StorageSync
+
+
+
+ netstandard2.0
+ Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helpers
+ Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helpers
+ $(NoWarn);CS0108;CS1573;CS0114
+
+
+
\ No newline at end of file
diff --git a/src/StorageSync/StorageSync.sln b/src/StorageSync/StorageSync.sln
index f3090f63b5f3..152c89331dc3 100644
--- a/src/StorageSync/StorageSync.sln
+++ b/src/StorageSync/StorageSync.sln
@@ -37,7 +37,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestF
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StorageSync.Management.Sdk", "StorageSync.Management.Sdk\StorageSync.Management.Sdk.csproj", "{3D256234-F790-4163-8B45-B99A12022585}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Storage.common", "..\Storage\Storage.common\Storage.common.csproj", "{9A1A777F-25E1-4352-8347-13E96814A6CA}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Storage.common", "..\Storage\Storage.common\Storage.common.csproj", "{9A1A777F-25E1-4352-8347-13E96814A6CA}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StorageSync.Helper", "StorageSync.Helpers\StorageSync.Helper.csproj", "{3BD1FC0B-912C-481B-B755-D958E42FA974}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -105,6 +107,10 @@ Global
{9A1A777F-25E1-4352-8347-13E96814A6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A1A777F-25E1-4352-8347-13E96814A6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A1A777F-25E1-4352-8347-13E96814A6CA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3BD1FC0B-912C-481B-B755-D958E42FA974}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3BD1FC0B-912C-481B-B755-D958E42FA974}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3BD1FC0B-912C-481B-B755-D958E42FA974}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3BD1FC0B-912C-481B-B755-D958E42FA974}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/StorageSync/StorageSync/Az.StorageSync.psd1 b/src/StorageSync/StorageSync/Az.StorageSync.psd1
index 99bedac7d757..1cb56d71b37a 100644
--- a/src/StorageSync/StorageSync/Az.StorageSync.psd1
+++ b/src/StorageSync/StorageSync/Az.StorageSync.psd1
@@ -56,7 +56,7 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.0.1'; })
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = 'Microsoft.Azure.PowerShell.StorageSync.Management.Sdk.dll',
'System.CodeDom.dll', 'System.Management.dll',
- 'Microsoft.Azure.Management.Authorization.dll'
+ 'Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helpers.dll'
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
diff --git a/src/StorageSync/StorageSync/ChangeLog.md b/src/StorageSync/StorageSync/ChangeLog.md
index 8a115d0acd6e..645b171b3396 100644
--- a/src/StorageSync/StorageSync/ChangeLog.md
+++ b/src/StorageSync/StorageSync/ChangeLog.md
@@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
+* Removed "Microsoft.Azure.Management.Authorization" Version "2.13.0-preview" package reference
## Version 2.4.0
* Upgraded nuget package to signed package.
diff --git a/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs b/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs
index f0c4b8bcb172..6e65921438a2 100644
--- a/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs
+++ b/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs
@@ -19,7 +19,7 @@
using Microsoft.Azure.Commands.StorageSync.Common.Extensions;
using Microsoft.Azure.Commands.StorageSync.Models;
using Microsoft.Azure.Commands.StorageSync.Properties;
-using Microsoft.Azure.Management.Authorization.Models;
+using Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.Management.StorageSync;
using Microsoft.Azure.Management.StorageSync.Models;
diff --git a/src/StorageSync/StorageSync/Common/StorageSyncClientWrapper.cs b/src/StorageSync/StorageSync/Common/StorageSyncClientWrapper.cs
index 7284d73fd078..91dc44282ba6 100644
--- a/src/StorageSync/StorageSync/Common/StorageSyncClientWrapper.cs
+++ b/src/StorageSync/StorageSync/Common/StorageSyncClientWrapper.cs
@@ -19,8 +19,8 @@
using Microsoft.Azure.Commands.StorageSync.Interfaces;
using Microsoft.Azure.Commands.StorageSync.Interop.ManagedIdentity;
using Microsoft.Azure.Commands.StorageSync.Properties;
-using Microsoft.Azure.Management.Authorization;
-using Microsoft.Azure.Management.Authorization.Models;
+using Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization;
+using Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models;
using Microsoft.Azure.Management.Internal.Resources;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.Management.StorageSync;
diff --git a/src/StorageSync/StorageSync/Interfaces/IStorageSyncClientWrapper.cs b/src/StorageSync/StorageSync/Interfaces/IStorageSyncClientWrapper.cs
index 92d143f2193c..c57388549873 100644
--- a/src/StorageSync/StorageSync/Interfaces/IStorageSyncClientWrapper.cs
+++ b/src/StorageSync/StorageSync/Interfaces/IStorageSyncClientWrapper.cs
@@ -14,8 +14,8 @@
using Microsoft.Azure.Commands.Common.MSGraph.Version1_0;
using Microsoft.Azure.Commands.Common.MSGraph.Version1_0.Applications.Models;
-using Microsoft.Azure.Management.Authorization;
-using Microsoft.Azure.Management.Authorization.Models;
+using Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization;
+using Microsoft.Azure.PowerShell.Cmdlets.StorageSync.Helper.Authorization.Models;
using Microsoft.Azure.Management.Internal.Resources;
using Microsoft.Azure.Management.StorageSync;
using System;
diff --git a/src/StorageSync/StorageSync/StorageSync.csproj b/src/StorageSync/StorageSync/StorageSync.csproj
index f67a89882d59..5018a01955bf 100644
--- a/src/StorageSync/StorageSync/StorageSync.csproj
+++ b/src/StorageSync/StorageSync/StorageSync.csproj
@@ -12,7 +12,6 @@
-
@@ -27,6 +26,7 @@
+