public void CreatesNewPSResourceGroupWithUserTemplate() { CreatePSResourceGroupParameters expectedParameters = new CreatePSResourceGroupParameters() { ResourceGroupName = resourceGroupName, Location = resourceGroupLocation, TemplateFile = templateFile, DeploymentName = deploymentName, StorageAccountName = storageAccountName, TemplateVersion = "1.0", Tag = tags }; CreatePSResourceGroupParameters actualParameters = new CreatePSResourceGroupParameters(); PSResourceGroup expected = new PSResourceGroup() { Location = expectedParameters.Location, ResourceGroupName = expectedParameters.ResourceGroupName, Resources = new List <PSResource>() { new PSResource() { Name = "resource1" } }, Tags = expectedParameters.Tag }; resourcesClientMock.Setup(f => f.CreatePSResourceGroup(It.IsAny <CreatePSResourceGroupParameters>())) .Returns(expected) .Callback((CreatePSResourceGroupParameters p) => { actualParameters = p; }); cmdlet.Name = expectedParameters.ResourceGroupName; cmdlet.Location = expectedParameters.Location; cmdlet.TemplateFile = expectedParameters.TemplateFile; cmdlet.DeploymentName = expectedParameters.DeploymentName; cmdlet.TemplateVersion = expectedParameters.TemplateVersion; cmdlet.Tag = expectedParameters.Tag; cmdlet.ExecuteCmdlet(); Assert.Equal(expectedParameters.ResourceGroupName, actualParameters.ResourceGroupName); Assert.Equal(expectedParameters.Location, actualParameters.Location); Assert.Equal(expectedParameters.DeploymentName, actualParameters.DeploymentName); Assert.Equal(expectedParameters.GalleryTemplateIdentity, actualParameters.GalleryTemplateIdentity); Assert.Equal(expectedParameters.TemplateFile, actualParameters.TemplateFile); Assert.NotNull(actualParameters.TemplateParameterObject); Assert.Equal(expectedParameters.TemplateVersion, actualParameters.TemplateVersion); Assert.Equal(null, actualParameters.StorageAccountName); Assert.Equal(expectedParameters.Tag, actualParameters.Tag); commandRuntimeMock.Verify(f => f.WriteObject(expected), Times.Once()); }
public override void ExecuteCmdlet() { CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, Location = Location, Force = Force.IsPresent, Tag = Tag, ConfirmAction = ConfirmAction }; WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }
protected override void ProcessRecord() { CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, Location = Location, Force = Force.IsPresent, Tag = Tag, ConfirmAction = ConfirmAction }; WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }
public override void ExecuteCmdlet() { WriteWarning("The output object type of this cmdlet will be modified in a future release. Also, the usability of Tag parameter in this cmdlet will be modified in a future release. This will impact creating, updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494"); CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, Location = Location, Force = Force.IsPresent, Tag = Tag, ConfirmAction = ConfirmAction }; WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }
public override void ExecuteCmdlet() { WriteWarning("The output object type of this cmdlet will be modified in a future release."); CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, Location = Location, Force = Force.IsPresent, Tag = Tag, ConfirmAction = ConfirmAction }; WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }
protected override void ProcessRecord() { CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, Location = Location, Force = Force.IsPresent, Tag = Tag, ConfirmAction = ConfirmAction }; WriteWarning("The output object of this cmdlet will be modified in a future release."); WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }
public override void ExecuteCmdlet() { CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters() { ResourceGroupName = Name, Location = Location, DeploymentName = DeploymentName, GalleryTemplateIdentity = GalleryTemplateIdentity, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), TemplateVersion = TemplateVersion, StorageAccountName = StorageAccountName, Force = Force.IsPresent, ConfirmAction = ConfirmAction }; WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }
public override void ExecuteCmdlet() { CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, Location = Location, DeploymentName = DeploymentName, GalleryTemplateIdentity = GalleryTemplateIdentity, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), TemplateVersion = TemplateVersion, StorageAccountName = StorageAccountName, Force = Force.IsPresent, Tag = Tag, ConfirmAction = ConfirmAction }; if(!string.IsNullOrEmpty(DeploymentName) || !string.IsNullOrEmpty(GalleryTemplateIdentity) || !string.IsNullOrEmpty(TemplateFile) || !string.IsNullOrEmpty(TemplateVersion) || TemplateParameterObject != null || !string.IsNullOrEmpty(StorageAccountName)) { WriteWarning("The deployment parameters in New-AzureResourceGroup cmdlet is being deprecated and will be removed in a future release. Please use New-AzureResourceGroupDeployment to submit deployments."); } WriteWarning("The output object of this cmdlet will be modified in a future release."); WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); }