Skip to content

Websites: Adding support for MSI & Https in slots #5986

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 27, 2018

Conversation

panchagnula
Copy link
Contributor

@panchagnula panchagnula commented Apr 19, 2018

Description

Enables support for MSI & HttpsOnly settings in Slots. Also changed the MSI & slot properties to bool on webapp as well the cmdlet review description.

NOTE: This has been rebased to the the existing websites PR #5967

Checklist

@panchagnula
Copy link
Contributor Author

This change is rebased using the active PR #5967

The actual change is a single commit here cb48f36

@cormacpayne
Copy link
Member

@maddieclayton assigning to you (corresponding cmdlet review found here)

@@ -89,10 +89,17 @@ public class SetAzureWebAppSlotCmdlet : WebAppSlotBaseCmdlet
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

[Parameter(ParameterSetName = ParameterSet1Name, Position = 16, Mandatory = false, HelpMessage = "Enable MSI on an existing azure webapp")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove positions for these two parameters - there's no reason to have positions on non-mandatory parameters.

else
{
// disabling the identity property updates the siteconfig only
appSettings["WEBSITE_DISABLE_MSI"] = (!AssignIdentity).ToString();
Copy link
Contributor

@maddieclayton maddieclayton Apr 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just assign false here - the (!AssignIdentity).ToString() is unnecessary.

@@ -89,10 +89,17 @@ public class SetAzureWebAppSlotCmdlet : WebAppSlotBaseCmdlet
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for these new parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it for the webapp version

if (parameters.Contains("AppServicePlan"))
{
WebsitesClient.UpdateWebApp(ResourceGroupName, location, Name, Slot, AppServicePlan);
}

if (parameters.Contains("AssignIdentity") || parameters.Contains("HttpsOnly"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have a separate if loop here? Is it not the same as if (parameters.Any(p => CmdletHelpers.SiteParameters.Contains(p)))

@@ -97,11 +97,11 @@ public class SetAzureWebAppCmdlet : WebAppBaseCmdlet
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

[Parameter(ParameterSetName = ParameterSet1Name, Mandatory = false, HelpMessage = "Enable MSI on an existing azure webapp")]
public SwitchParameter AssignIdentity { get; set; }
[Parameter(ParameterSetName = ParameterSet1Name, Position= 16, Mandatory = false, HelpMessage = "Enable MSI on an existing azure webapp")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove position for these two as well.

@@ -172,10 +173,8 @@ public override void ExecuteCmdlet()
else
{
// disabling the identity property updates the siteconfig only
appSettings["WEBSITE_DISABLE_MSI"] = (!AssignIdentity.IsPresent).ToString();
appSettings["WEBSITE_DISABLE_MSI"] = (!AssignIdentity).ToString();
Copy link
Contributor

@maddieclayton maddieclayton Apr 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just assign false here - the (!AssignIdentity).ToString() is unnecessary.

@maddieclayton
Copy link
Contributor

@panchagnula Can you also update the webappslot tests with your changes? After this, things look mostly good to me, but I'd like to take another quick look once website-preview is merged to preview and this PR only contains your changes.

@markcowl
Copy link
Member

@panchagnula You will need to pull in the latest and fix the failign tests

@markcowl
Copy link
Member

@panchagnula Note that you should not use boolean parameters - use switch parameters instead

@markcowl markcowl changed the base branch from preview to release-6.0.0 April 26, 2018 19:05
@@ -89,10 +89,17 @@ public class SetAzureWebAppSlotCmdlet : WebAppSlotBaseCmdlet
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

[Parameter(ParameterSetName = ParameterSet1Name, Mandatory = false, HelpMessage = "Enable MSI on an existing azure webapp")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a PATCH or a PUT? If it is a PATCH, this is OK. If it is a PUT, then these should be switch parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a PATCH Mark, but during our commandlet review (https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/51)we concluded that

  1. this can be confusing for customers, since the rest of the properties use a bool
  2. customers can accidentally turn off the property by running the set command without any parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i propose that we update all the properties of the SetWebApp & SetWebAppSlot to use the switch parameter as a separate change, i agree switch parameter is the valid PowerShell way , however to have consistency we should change all which i want to avoid this time, since its a bigger change. Let me know your thoughts!

Copy link
Member

@markcowl markcowl Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For PATCH boolean parameters are acceptable, for PUT they are not. I am OK with this for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you this is the issue to track this #6066

@panchagnula panchagnula force-pushed the sisirap-BUILD-Merged-MSI branch from 8581c5c to a0a914a Compare April 26, 2018 23:06
@markcowl
Copy link
Member

@markcowl markcowl merged commit 05a4844 into Azure:release-6.0.0 Apr 27, 2018
@panchagnula panchagnula deleted the sisirap-BUILD-Merged-MSI branch June 7, 2018 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants