Azure / Azure/azure-powershell
[Az.ManagedServices] Updating existing Managed Services Definition creates a new definition
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
## Resources
* Documentation - https://docs.microsoft.com/en-us/powershell/module/az.managedservices/New-AzManagedServicesDefinition?view=azps-3.6.1#description
* Module (with version I used): https://www.powershellgallery.com/packages/Az.ManagedServices/1.0.2
## Description / Reproduction
According to linked documentation, you can use "New-AzManagedServicesDefinition" to create or update existing registration definition.
From what I can see of examples, the following should be all parameters needed to add a new authorization to an existing Manages Services Definition, or am I wrong / not understanding its' use?
```powershell
$null = New-AzManagedServicesDefinition -Name $ExistingAzManagedServicesDefinitions.'Properties'.'Name' `
-ManagedByTenantId $ExistingAzManagedServicesDefinitions.'Properties'.'ManagedByTenantId' `
-PrincipalId $Authorization.'Key' -RoleDefinitionId $Authorization.'Value'
```
Where:
* $ExistingAzManagedServicesDefinitions is an existing Managed Services Definition found with "Get-AzManagedServicesDefinition".
* $Authorization is a hashtable containing a single Azure AD group from provider tenant (Key) and RBAC role id (Value) for "Reader".
## Expected Result
A new authorization is added to the existing Managed Services Definition.
## Actual result
The command runs successfully, but on managed tenant a new Managed Services Definition appears with the exact same name as the existing one, and no assignments.
## Questions
* How am I supposed to update: add or remove (I haven't dared trying this yet) authorizations to existing Managed Services Definitions with the "New-AzManagedServicesDefinition" and "Remove-AzManagedServicesDefinition" commands, as the documentation states is possible?
* Given the original issue here: How can I create a Managed Services Definition with multiple authorizations when "New-AzManagedServicesDefinition" only takes a single authorization as input?
*This module for Managed Services seems kind of useless without having said abilities tbh.*
Contributor guide
Assessment
This issue has not been assessed yet.