Skip to content

Commit

Permalink
Merge pull request #6527 from cormacpayne/fix-add-member
Browse files Browse the repository at this point in the history
Fix a few issues with AD cmdlets
  • Loading branch information
cormacpayne authored Jun 25, 2018
2 parents eca9735 + 6752dd7 commit 11e984c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class AddAzureADGroupMemberCommand : ActiveDirectoryBaseCmdlet
[Parameter(Mandatory = true, ParameterSetName = ParameterSet.MemberUPNWithGroupDisplayName, HelpMessage = "The display name of the group to add the member(s) to.")]
public string TargetGroupDisplayName { get; set; }

[Parameter(Mandatory = true)]
[Parameter(Mandatory = false)]
public SwitchParameter PassThru { get; set; }

public override void ExecuteCmdlet()
Expand Down Expand Up @@ -86,9 +86,9 @@ public override void ExecuteCmdlet()
{
var groupAddMemberParams = new GroupAddMemberParameters()
{
Url = string.Format("{0}/{1}/directoryObjects/{2}",
Url = string.Format("{0}{1}/directoryObjects/{2}",
AzureEnvironmentConstants.AzureGraphEndpoint,
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant,
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Id,
memberObjectId)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ public override void ExecuteCmdlet()
{
ExecutionBlock(() =>
{
EndDate = StartDate.AddYears(1);
if (!this.IsParameterBound(c => c.EndDate))
{
WriteVerbose("No value specified for -EndDate parameter; setting the value to one year after start date.");
EndDate = StartDate.AddYears(1);
}

if (this.IsParameterBound(c => c.ApplicationObject))
{
ObjectId = ApplicationObject.ObjectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class RemoveAzureADGroupMemberCommand : ActiveDirectoryBaseCmdlet
[ValidateNotNullOrEmpty]
public PSADGroup GroupObject { get; set; }

[Parameter(Mandatory = true)]
[Parameter(Mandatory = false)]
public SwitchParameter PassThru { get; set; }

public override void ExecuteCmdlet()
Expand Down
14 changes: 9 additions & 5 deletions src/ResourceManager/Resources/Commands.Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
## Version 6.1.1
* Fix error in `New-AzureRmRoleAssignment` help
* Fixed formatting of OutputType in help files
* Fix issue where `-EndDate` parameter was ignored for `New-AzureRmADAppCredential`
- https://github.com/Azure/azure-powershell/issues/6505
* Fix issue where `Add-AzureRmADGroupMember` used incorrect URL to make request
- https://github.com/Azure/azure-powershell/issues/6485

## Version 6.1.0
* Fix issue with `Properties` property of `PSResource` object(s) returned from `Get-AzureRmResource`
Expand Down Expand Up @@ -105,7 +109,7 @@
## Version 5.0.0
* Add support for online help
- Run Get-Help with the -Online parameter to open the online help in your default Internet browser

## Version 4.4.1

## Version 4.4.0
Expand All @@ -129,7 +133,7 @@
* Add -Mode parameter to New-AzureRmPolicyDefinition cmdlet
* Add Support for removal of roleassignment using PSRoleAssignment object
- Users can now use PSRoleassignmnet inputobject with Remove-AzureRMRoleAssignment commandlet to remove the roleassignment.

## Version 4.3.1

## Version 4.3.0
Expand All @@ -149,7 +153,7 @@
## Version 4.1.0
* Fixed issue where Get-AzureRMRoleAssignment would result in a Bad Request if the number of roleassignments where greater than 1000
- Users can now use Get-AzureRMRoleAssignment even if the roleassignments to be returned is greater than 1000

## Version 4.0.1

## Version 4.0.0
Expand All @@ -163,12 +167,12 @@
## Version 3.6.0
* Support policy parameters for New-AzureRmPolicyDefinition and New-AzureRmPolicyAssignment
- Users can now use Parameter parameter with New-AzureRmPolicyDefinition. This accepts both JSON string and file path.
- Users can now provide policy parameter values in New-AzureRmPolicyAssignment in a couple of ways, including JSON string, file path, PS object, and through PowerShell parameters.
- Users can now provide policy parameter values in New-AzureRmPolicyAssignment in a couple of ways, including JSON string, file path, PS object, and through PowerShell parameters.

## Version 3.5.0
* Support Tag as parameters for Find-AzureRmResource
- Users can now use Tag parameter with Find-AzureRmResource
- Fixed the issue where illegal combinations of TagName, TagValue with other search parameters was allowed in Find-AzureRmResource and would result in users getting exception from the service by disallowing such combinations.
- Fixed the issue where illegal combinations of TagName, TagValue with other search parameters was allowed in Find-AzureRmResource and would result in users getting exception from the service by disallowing such combinations.

## Version 3.4.0
* Support ResourceNameEquals and ResourceGroupNameEquals as parameters for Find-AzureRmResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: True
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Aliases: Id
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: True
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Expand Down

0 comments on commit 11e984c

Please sign in to comment.