-
Notifications
You must be signed in to change notification settings - Fork 4k
[ApiManagement] Secure Parameter for Cmdlets #4837
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
Conversation
* Breaking Changes in Cmdlet to Manage Api Management Users Azure#4595 - New-AzureRmApiManagementUser Parameter `Password` is changed from String to SecureString - Set-AzureRmApiManagementBackend Parameter `Password` is changed from String to SecureString * Breaking Changes in Cmdlet to Create Backend Proxy Object - New-AzureRmApiManagementBackendProxy Parameter `Password` and `UserName` has been replaced with `ProxyCredentials` of type PSCredential
* Updated Cmdlet Get-AzureRmApiManagementUser to fix issue Azure#4510
* Updated Cmdlet New-AzureRmApiManagementApi to create Api with Empty Path Azure#4069
* Updated documentation for issue Azure#4676
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.
A few small things to fix.
@@ -2039,10 +2043,9 @@ Param($resourceGroupName, $serviceName) | |||
$backendId = getAssetName | |||
try | |||
{ |
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 fix spacing issues with this test
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.
fixed formatting throughout the file using VSCode extension for Powershell
{ | ||
var user = Client.UsersList(Context, FirstName, LastName, Email, State, GroupId); | ||
WriteObject(user, true); | ||
} | ||
else |
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 shouldn't need this else statement anymore because all three parameter sets are covered (and powershell will always resolve to one parameter set).
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.
done
@@ -916,6 +916,55 @@ Param($resourceGroupName, $serviceName) | |||
Assert-AreEqual $userNote $user.Note | |||
Assert-AreEqual $userState $user.State | |||
|
|||
#find user by email |
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 you add a few tests with multiple byId parameters (both first and last name for example)?
- Set-AzureRmApiManagementBackend Parameter `Password` is changed from String to SecureString | ||
|
||
* Breaking Changes in Cmdlet to Create Backend Proxy Object | ||
- New-AzureRmApiManagementBackendProxy Parameter `Password` and `UserName` has been replaced with `ProxyCredentials` of type PSCredential |
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.
Should be "... Parameters Password
and UserName
have been replaced..."
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.
done
@@ -39,20 +43,23 @@ The **Get-AzureRmApiManagementApi** cmdlet gets one or more Azure API Management | |||
|
|||
### Example 1: Get all management APIs | |||
``` | |||
PS C:\>Get-AzureRmApiManagementApi -Context $ApiMgmtContext |
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.
It would be nice if these examples also had sample output, but not a blocker for this PR.
@@ -24,13 +25,28 @@ The context is used for all of the API Management service cmdlets. | |||
|
|||
### Example 1: Create a PsApiManagementContext instance | |||
``` | |||
PS C:\>$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "ContosoResources" -ServiceName "Contoso" | |||
PS C:\>PS C:\>$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "ContosoResources" -ServiceName "Contoso" |
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 extra powershell prompt
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.
done
@@ -58,7 +58,7 @@ $RequestRepresentation.Sample = '{ "propName": "propValue" }' | |||
$Request.Representations = @($requestRepresentation) | |||
$Response = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementResponse | |||
$Response.StatusCode = 204 | |||
New-AzureRmApiManagementOperation -Context $APImContext -ApiId $APIId -OperationId "01234567890" -Name 'Create/update resource' -Method 'PUT' -UrlTemplate '/resource/{rid}?q={query}' -Description "Use this operation to create new or update existing resource" -TemplateParameters @($rid, $query) -Request $Request -Responses @($response) | |||
New-AzureRmApiManagementOperation -Context $apimContext -ApiId $APIId -OperationId "01234567890" -Name 'Create/update resource' -Method 'PUT' -UrlTemplate '/resource/{rid}?q={query}' -Description "Use this operation to create new or update existing resource" -TemplateParameters @($rid, $query) -Request $Request -Responses @($response) |
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.
Add "PS C:>" to all separate powershell commands
@@ -25,7 +25,8 @@ The **New-AzureRmApiManagementUser** cmdlet registers a new user. | |||
|
|||
### Example 1: Register a new user | |||
``` | |||
PS C:\>New-AzureRmApiManagementUser -Context $apimContext -FirstName "Patti" -LastName "Fuller" -Email "[email protected]" -Password "qwerty" | |||
$securePassword = ConvertTo-SecureString "qwerty" -AsPlainText -Force |
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.
Add "PS C:>"
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.
done
``` | ||
PS C:\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso" | ||
Remove-AzureRmApiManagementIdentityProvider -Context $apimContext -Type 'Facebook' -PassThru |
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.
Add "PS C:>"
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.
done
@@ -25,7 +25,9 @@ The **Set-AzureRmApiManagementUser** cmdlet sets user details. | |||
|
|||
### Example 1: Change a user's password, email address and state | |||
``` | |||
PS C:\>Set-AzureRmApiManagementUser -Context $apimContext -UserId "0123456789" -Email "[email protected]" -Password "asdfgh" -State "Blocked" | |||
PS C:\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso" | |||
$securePassword = ConvertTo-SecureString "qwerty" -AsPlainText -Force |
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.
Add "PS C:>"
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.
done
#sign-off |
Description
Breaking Changes in Cmdlet to Manage Api Management Users [Nov Release] Update Cmdlets to use SecureString and PsCredentialType #4595
Password
is changed from String to SecureStringPassword
is changed from String to SecureStringBreaking Changes in Cmdlet to Create Backend Proxy Object
Password
andUserName
has been replaced withProxyCredentials
of type PSCredentialUpdated Cmdlet Get-AzureRmApiManagementUser to fix issue Get-AzureRmApiManagementUser - Parameter set name 'Find users' is not supported #4510
Updated Cmdlet New-AzureRmApiManagementApi to create Api with Empty Path New-AzureRmApiManagement should allow creating API with Empty Path #4069
Updated documentation for issue Get-AzureRmApiManagementSubscription ByProduct does not return same Type consistently #4676
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines