-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Websites: Adding support for MSI & Https in slots #5986
Conversation
@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")] |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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")] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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")] |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
cb48f36
to
8581c5c
Compare
@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. |
@panchagnula You will need to pull in the latest and fix the failign tests |
@panchagnula Note that you should not use boolean parameters - use switch parameters instead |
@@ -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")] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
- this can be confusing for customers, since the rest of the properties use a bool
- customers can accidentally turn off the property by running the set command without any parameters
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
8581c5c
to
a0a914a
Compare
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
CONTRIBUTING.md
platyPS
module