public override void ExecuteCmdlet() { if (ParameterSetName.Equals(ParameterSetNames.ByFactoryObject, StringComparison.OrdinalIgnoreCase)) { Name = InputObject.DataFactoryName; ResourceGroupName = InputObject.ResourceGroupName; } else if (ParameterSetName.Equals(ParameterSetNames.ByResourceId, StringComparison.OrdinalIgnoreCase)) { var parsedResourceId = new ResourceIdentifier(ResourceId); Name = parsedResourceId.ResourceName; ResourceGroupName = parsedResourceId.ResourceGroupName; } var parameters = new UpdatePSDataFactoryParameters() { ResourceGroupName = ResourceGroupName, DataFactoryName = Name, Tags = Tag }; if (ShouldProcess(Name)) { WriteObject(DataFactoryClient.UpdatePSDataFactory(parameters)); } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(ParameterSetNames.ByFactoryObject, StringComparison.OrdinalIgnoreCase)) { Name = InputObject.DataFactoryName; ResourceGroupName = InputObject.ResourceGroupName; } else if (ParameterSetName.Equals(ParameterSetNames.ByResourceId, StringComparison.OrdinalIgnoreCase)) { var parsedResourceId = new ResourceIdentifier(ResourceId); Name = parsedResourceId.ResourceName; ResourceGroupName = parsedResourceId.ResourceGroupName; } string factoryIdentityType = FactoryIdentityType.SystemAssigned; if (!string.IsNullOrWhiteSpace(this.IdentityType)) { factoryIdentityType = this.IdentityType; } if (this.UserAssignedIdentity != null && this.UserAssignedIdentity.Count > 0) { if (!factoryIdentityType.ToLower().Contains(FactoryIdentityType.UserAssigned.ToLower())) { factoryIdentityType = FactoryIdentityType.SystemAssignedUserAssigned; } } FactoryIdentity factoryIdentity = new FactoryIdentity(factoryIdentityType, userAssignedIdentities: this.UserAssignedIdentity); EncryptionConfiguration encryption = null; if (!string.IsNullOrWhiteSpace(this.EncryptionVaultBaseUrl) && !string.IsNullOrWhiteSpace(this.EncryptionKeyName)) { CMKIdentityDefinition cmkIdentity = null; if (!string.IsNullOrWhiteSpace(this.EncryptionUserAssignedIdentity)) { cmkIdentity = new CMKIdentityDefinition(this.EncryptionUserAssignedIdentity); } encryption = new EncryptionConfiguration(this.EncryptionKeyName, this.EncryptionVaultBaseUrl, this.EncryptionKeyVersion, cmkIdentity); } var parameters = new UpdatePSDataFactoryParameters() { ResourceGroupName = ResourceGroupName, DataFactoryName = Name, EncryptionConfiguration = encryption, FactoryIdentity = factoryIdentity, Tags = Tag }; if (ShouldProcess(Name)) { WriteObject(DataFactoryClient.UpdatePSDataFactory(parameters)); } }
public PSDataFactory UpdatePSDataFactory(UpdatePSDataFactoryParameters parameters) { var updateParams = new FactoryUpdateParameters(parameters.Tags?.ToDictionary()); return(new PSDataFactory( this.DataFactoryManagementClient.Factories.Update( parameters.ResourceGroupName, parameters.DataFactoryName, updateParams), parameters.ResourceGroupName)); }