The `az managedapp create` does not validate the `--managed-rg-id` in time
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
**Describe the bug**
When running the ``az managedapp create`` with the invalid ``---managed-rg-id`` group name (for example, with the whitespace), azure still creates the manage application. But this application is invalid and CANNOT be deleted (!!!) from the resource group after that.
**To Reproduce**
1) Create a simple managed application definition in a resource group.
2) Now create a managed app by running:
```
az managedapp create \
--name 'my_managed_add' \
--kind 'servicecatalog' \
--managed-rg-id '/subscriptions/{SubId}/resourceGroups/my_app invalid group name' \
--resource-group "parent_rg" \
--managedapp-definition-id '{ManagedAppDefinitionId}'
```
This command will fail with:
```
(ApplianceProvisioningFailed) The provided resource group name 'my_app invalid group name' has these invalid characters: ' '. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Code: ApplianceProvisioningFailed
Message: The provided resource group name 'my_app invalid group name' has these invalid characters: ' '. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
```
But the resource group now contains the managed application:
```
az managedapp list -g parent_rg
```
The most annoying problem with that is that I cannot delete that broken managed application from the group. And I'm getting again the
ApplianceProvisioningFailed error:
```
az managedapp delete \
--ids '{CreatedManagedAppId}'
(ApplianceProvisioningFailed) The provided resource group name 'my_app invalid group name' has these invalid characters: ' '. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Code: ApplianceProvisioningFailed
Message: The provided resource group name 'my_app invalid group name' has these invalid characters: ' '. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
```
**Expected behavior**
The ``az managedapp create`` command should fail earlier and properly validate the input. Or, at least we should be able to delete the broken managed applications.
**Environment summary**
Linux-5.15.14-200.fc35.x86_64-x86_64-with-fedora-35-Thirty_Five, Fedora Linux 35 (Workstation Edition)
Python 3.6.15
Installer: RPM
```
az version
{
"azure-cli": "2.32.0",
"azure-cli-core": "2.32.0",
"azure-cli-telemetry": "1.0.6",
"extensions": {}
}
```
**Additional context**
Contributor guide
Assessment
This issue has not been assessed yet.