Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 7c06c70

Browse files
calvinsIDrunefaHaroon Feisalanthonychuzhoxing-ms
authored
Containerapps 4/11 Release [ Supporting MSI for ACA & some bug fixes] (Azure#4660)
* Marchp1s and add back Identity (#57) * Skeleton code * az containerapp env show * List kube/managed environments * Create kube environment, wait doesn't work yet * Update containerapp stubs (check if it is supported now) * Containerapp env delete, polling not working yet * Added polling for create and delete * Use Microsoft.App RP for show, list, delete command * Create containerapp env using Microsoft.App RP * Add optional containerapp env create arguments * Remove old kube environment code, naming fixes * Containerapp create almost done * Done containerapp create, except for --yaml. Need to test * Containerapp show, list * Fix helptext * Containerapp delete * Containerapp update. Needs secrets api to be implemented, and testing * Add scale command * Various validations, small fixes * listSecrets API for updates, autogen log analytics for env * Use space delimiter for secrets and env variables * Verify sub is registered to Microsoft.ContainerRegistration if creating vnet enabled env, remove logs-type parameter * Containerapp create --yaml * Fix updating registry to do create or update * Fix containerapp update command. Add image-name parameter to support multi container updates. Fix updating registries, containers and secrets * started update with --yaml. Need to do create or update for when an attribute is a list of items * use space delimiter for startup_command and args, instead of comma delimiter * Traffic weights * List and show revisions * az containerapp revision restart, activate, deactivate * Add ability for users to clear args/command in az containerapp update * Various fixes, traffic weights fixes * Verify subnet subscription is registered to Microsoft.ContainerServices * GitHub Actions Update (#17) * Added models. Finished transferring Calvin's previous work. * Updated wrong models. * Updated models in custom.py, added githubactionclient. * Updated envelope to be correct. * Small bug fixes. * Updated error handling. Fixed bugs. Initial working state. * Added better error handling. * Added error messages for tokens with inappropriate access rights. * Added back get_acr_cred. * Fixed problems from merge conflict. * Updated names of imports from ._models.py to fix pylance erros. * Removed random imports. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Remove --location since location must be same as managed env * Add options for flag names: --env-vars and --registry-srever * Empty string to clear env_vars * Default revisions_mode to single * Infer acr credentials if it is acr and credentials are not provided * fix help msg * if image is hosted on acr, and no registry server is supplied, infer the registry server * Added subgroups (Ingress, Registry, Secret) and updated revisions (#18) * Added ingress subgroup. * Added help for ingress. * Fixed ingress traffic help. * Added registry commands. * Updated registry remove util to clear secrets if none remaining. Added warning when updating existing registry. Added registry help. * Changed registry delete to remove. * Added error message if user tries to remove non assigned registry. * Changed registry add back to registry set. * Added secret subgroup commands. * Removed yaml support from secret set. * Changed secret add to secret set. Updated consistency between secret set and secret delete. Added secret help. Require at least one secret passed with --secrets for secret commands. * Changed param name for secret delete from --secrets to --secret-names. Updated help. * Changed registry remove to registry delete. * Fixed bug in registry delete. * Added revision mode set and revision copy. * Modified update_containerapp_yaml to support updating from non-current revision. Authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * More p0 fixes (#20) * Remove --registry-login-server, only allow --registry-server * Rename --environment-variables to --env-vars * If no image is supplied, use default quickstart image * Update help text (#21) * Update help text * Update punctuation * master -> main * New 1.0.1 version * Added identity commands + --assign-identity flag to containerapp create (#8) * Added identity show and assign. * Finisheed identity remove. * Added helps, updated identity remove to work with identity names instead of requiring identity resource ids. * Moved helper function to utils. * Require --identities flag when removing identities. * Added message for assign identity with no specified identity. * Added --assign-identity flag to containerapp create. * Moved assign-identity flag to containerapp create. * Fixed small logic error on remove identities when passing duplicate identities. Added warnings for certain edge cases. * Updated param definition for identity assign --identity default. * Added identity examples in help. * Made sure secrets were not removed when assigning identities. Added tolerance for [system] passed with capital letters. * Fixed error from merge. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Dapr Commands (#23) * Added ingress subgroup. * Added help for ingress. * Fixed ingress traffic help. * Added registry commands. * Updated registry remove util to clear secrets if none remaining. Added warning when updating existing registry. Added registry help. * Changed registry delete to remove. * Added error message if user tries to remove non assigned registry. * Changed registry add back to registry set. * Added secret subgroup commands. * Removed yaml support from secret set. * Changed secret add to secret set. Updated consistency between secret set and secret delete. Added secret help. Require at least one secret passed with --secrets for secret commands. * Changed param name for secret delete from --secrets to --secret-names. Updated help. * Changed registry remove to registry delete. * Fixed bug in registry delete. * Added revision mode set and revision copy. * Added dapr enable and dapr disable. Need to test more. * Added list, show, set dapr component. Added dapr enable, disable. * Added delete dapr delete. * Added helps and param text. * Changed dapr delete to dapr remove to match with dapr set. * Commented out managed identity for whl file. * Uncommented. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Rename --image-name to --container-name * Remove allowInsecure since it was messing with the api parsing * Fix for env var being empty string * Rename to --dapr-instrumentation-key, only infer ACR credentials if --registry-server is provided * Remove az containerapp scale * Fix delete containerapp errors * Remove ingress, dapr flags from az containerapp update/revision copy * Fix revision list -o table * Help text fix * Bump extension to 0.1.2 * Update managed identities and Dapr help text (#25) * Update managed identities and Dapr help text * Update Dapr flags * Add secretref note * Env var options + various bug fixes (#26) * Moved dapr arguments to env as a subgroup. * Added env variable options. * Changed revision mode set to revision set-mode. * Added env var options to revision copy. * Fixed revision copy bug related to env secret refs. * Changed registry and secret delete to remove. Added registry param helps. Removed replica from table output and added trafficWeight. * Updating warning text. * Updated warning text once more. * Made name optional for revision copy if from-revision flag is passed. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Fixed style issues, various bug fixes (#27) * Moved dapr arguments to env as a subgroup. * Added env variable options. * Changed revision mode set to revision set-mode. * Added env var options to revision copy. * Fixed revision copy bug related to env secret refs. * Changed registry and secret delete to remove. Added registry param helps. Removed replica from table output and added trafficWeight. * Updating warning text. * Updated warning text once more. * Made name optional for revision copy if from-revision flag is passed. * Fixed whitespace style issues. * Styled clients and utils to pass pylint. * Finished client.py pylint fixes. * Fixed pylint issues. * Fixed flake8 commands and custom. * Fixed flake issues in src. * Added license header to _sdk_models. * Added confirmation for containerapp delete. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Update src/containerapp/azext_containerapp/tests/latest/test_containerapp_scenario.py Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com> * Specific Error Types + Bugfixes (Help, remove app-subnet-resource-id, removed env-var alias, added help text for --name) (#28) * Moved dapr arguments to env as a subgroup. * Added env variable options. * Changed revision mode set to revision set-mode. * Added env var options to revision copy. * Fixed revision copy bug related to env secret refs. * Changed registry and secret delete to remove. Added registry param helps. Removed replica from table output and added trafficWeight. * Updating warning text. * Updated warning text once more. * Made name optional for revision copy if from-revision flag is passed. * Fixed whitespace style issues. * Styled clients and utils to pass pylint. * Finished client.py pylint fixes. * Fixed pylint issues. * Fixed flake8 commands and custom. * Fixed flake issues in src. * Added license header to _sdk_models. * Added confirmation for containerapp delete. * Update helps for identity, revision. Removed env-var alias for set-env-vars. Added name param help. * Removed app-subnet-resource-id. * Updated infrastructure subnet param help. * Check if containerapp resource exists before attempting to delete. * Added check before deleting managed env. * Changed error types to be more specific. * Removed check before deletion. Removed comments. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Reset to 0.1.0 version, remove unneeded options-list * Update min cli core version * Fixed style issues. (#30) Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Fix linter issues * Use custom-show-command * Removed --ids from revision, secret, registry list. * Add linter exclusions * Fix polling on delete containerapp * Fix error handling * Add Container App Service * Fix flake linter * Fix help text * Mark extension as preview * Add python 3.9 and 3.10 as supported * Remove registries and secrets from az containerapp update, in favor of registry and secret subgroup * Fix YAML not working * Move import to inside deserialize function * Ingress enable --transport default. Secret list returns empty array. Secret update prints message saying user needs to restart their apps. Added show-values flag to secret list. Fixed yaml datetime field issues, replaced x00 values that also came up during testing. * Fixed dapr in create. * Revert "Ingress enable --transport default. Secret list returns empty array. Secret update prints message saying user needs to restart their apps. Added show-values flag to secret list. Fixed yaml datetime field issues, replaced x00 values that also came up during testing." This reverts commit 51bc543. * Revert "Fixed dapr in create." This reverts commit 37030ad. * Ingress enable --transport default. Secret list returns empty array. Secret update prints message saying user needs to restart their apps. Added show-values flag to secret list. Fixed yaml datetime field issues, replaced x00 values that also came up during testing. * Skeleton code * az containerapp env show * List kube/managed environments * Create kube environment, wait doesn't work yet * Update containerapp stubs (check if it is supported now) * Containerapp env delete, polling not working yet * Added polling for create and delete * Use Microsoft.App RP for show, list, delete command * Create containerapp env using Microsoft.App RP * Add optional containerapp env create arguments * Remove old kube environment code, naming fixes * Containerapp create almost done * Done containerapp create, except for --yaml. Need to test * Containerapp show, list * Fix helptext * Containerapp delete * Containerapp update. Needs secrets api to be implemented, and testing * Add scale command * Various validations, small fixes * listSecrets API for updates, autogen log analytics for env * Use space delimiter for secrets and env variables * Verify sub is registered to Microsoft.ContainerRegistration if creating vnet enabled env, remove logs-type parameter * Containerapp create --yaml * Fix updating registry to do create or update * Fix containerapp update command. Add image-name parameter to support multi container updates. Fix updating registries, containers and secrets * started update with --yaml. Need to do create or update for when an attribute is a list of items * use space delimiter for startup_command and args, instead of comma delimiter * Traffic weights * List and show revisions * az containerapp revision restart, activate, deactivate * Add ability for users to clear args/command in az containerapp update * Various fixes, traffic weights fixes * Verify subnet subscription is registered to Microsoft.ContainerServices * GitHub Actions Update (#17) * Added models. Finished transferring Calvin's previous work. * Updated wrong models. * Updated models in custom.py, added githubactionclient. * Updated envelope to be correct. * Small bug fixes. * Updated error handling. Fixed bugs. Initial working state. * Added better error handling. * Added error messages for tokens with inappropriate access rights. * Added back get_acr_cred. * Fixed problems from merge conflict. * Updated names of imports from ._models.py to fix pylance erros. * Removed random imports. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Remove --location since location must be same as managed env * Add options for flag names: --env-vars and --registry-srever * Empty string to clear env_vars * Default revisions_mode to single * Infer acr credentials if it is acr and credentials are not provided * fix help msg * if image is hosted on acr, and no registry server is supplied, infer the registry server * Added subgroups (Ingress, Registry, Secret) and updated revisions (#18) * Added ingress subgroup. * Added help for ingress. * Fixed ingress traffic help. * Added registry commands. * Updated registry remove util to clear secrets if none remaining. Added warning when updating existing registry. Added registry help. * Changed registry delete to remove. * Added error message if user tries to remove non assigned registry. * Changed registry add back to registry set. * Added secret subgroup commands. * Removed yaml support from secret set. * Changed secret add to secret set. Updated consistency between secret set and secret delete. Added secret help. Require at least one secret passed with --secrets for secret commands. * Changed param name for secret delete from --secrets to --secret-names. Updated help. * Changed registry remove to registry delete. * Fixed bug in registry delete. * Added revision mode set and revision copy. * Modified update_containerapp_yaml to support updating from non-current revision. Authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * More p0 fixes (#20) * Remove --registry-login-server, only allow --registry-server * Rename --environment-variables to --env-vars * If no image is supplied, use default quickstart image * Update help text (#21) * Update help text * Update punctuation * master -> main * New 1.0.1 version * Added identity commands + --assign-identity flag to containerapp create (#8) * Added identity show and assign. * Finisheed identity remove. * Added helps, updated identity remove to work with identity names instead of requiring identity resource ids. * Moved helper function to utils. * Require --identities flag when removing identities. * Added message for assign identity with no specified identity. * Added --assign-identity flag to containerapp create. * Moved assign-identity flag to containerapp create. * Fixed small logic error on remove identities when passing duplicate identities. Added warnings for certain edge cases. * Updated param definition for identity assign --identity default. * Added identity examples in help. * Made sure secrets were not removed when assigning identities. Added tolerance for [system] passed with capital letters. * Fixed error from merge. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Dapr Commands (#23) * Added ingress subgroup. * Added help for ingress. * Fixed ingress traffic help. * Added registry commands. * Updated registry remove util to clear secrets if none remaining. Added warning when updating existing registry. Added registry help. * Changed registry delete to remove. * Added error message if user tries to remove non assigned registry. * Changed registry add back to registry set. * Added secret subgroup commands. * Removed yaml support from secret set. * Changed secret add to secret set. Updated consistency between secret set and secret delete. Added secret help. Require at least one secret passed with --secrets for secret commands. * Changed param name for secret delete from --secrets to --secret-names. Updated help. * Changed registry remove to registry delete. * Fixed bug in registry delete. * Added revision mode set and revision copy. * Added dapr enable and dapr disable. Need to test more. * Added list, show, set dapr component. Added dapr enable, disable. * Added delete dapr delete. * Added helps and param text. * Changed dapr delete to dapr remove to match with dapr set. * Commented out managed identity for whl file. * Uncommented. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Rename --image-name to --container-name * Remove allowInsecure since it was messing with the api parsing * Fix for env var being empty string * Rename to --dapr-instrumentation-key, only infer ACR credentials if --registry-server is provided * Remove az containerapp scale * Fix delete containerapp errors * Remove ingress, dapr flags from az containerapp update/revision copy * Fix revision list -o table * Help text fix * Bump extension to 0.1.2 * Update managed identities and Dapr help text (#25) * Update managed identities and Dapr help text * Update Dapr flags * Add secretref note * Env var options + various bug fixes (#26) * Moved dapr arguments to env as a subgroup. * Added env variable options. * Changed revision mode set to revision set-mode. * Added env var options to revision copy. * Fixed revision copy bug related to env secret refs. * Changed registry and secret delete to remove. Added registry param helps. Removed replica from table output and added trafficWeight. * Updating warning text. * Updated warning text once more. * Made name optional for revision copy if from-revision flag is passed. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Fixed style issues, various bug fixes (#27) * Moved dapr arguments to env as a subgroup. * Added env variable options. * Changed revision mode set to revision set-mode. * Added env var options to revision copy. * Fixed revision copy bug related to env secret refs. * Changed registry and secret delete to remove. Added registry param helps. Removed replica from table output and added trafficWeight. * Updating warning text. * Updated warning text once more. * Made name optional for revision copy if from-revision flag is passed. * Fixed whitespace style issues. * Styled clients and utils to pass pylint. * Finished client.py pylint fixes. * Fixed pylint issues. * Fixed flake8 commands and custom. * Fixed flake issues in src. * Added license header to _sdk_models. * Added confirmation for containerapp delete. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Update src/containerapp/azext_containerapp/tests/latest/test_containerapp_scenario.py Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com> * Specific Error Types + Bugfixes (Help, remove app-subnet-resource-id, removed env-var alias, added help text for --name) (#28) * Moved dapr arguments to env as a subgroup. * Added env variable options. * Changed revision mode set to revision set-mode. * Added env var options to revision copy. * Fixed revision copy bug related to env secret refs. * Changed registry and secret delete to remove. Added registry param helps. Removed replica from table output and added trafficWeight. * Updating warning text. * Updated warning text once more. * Made name optional for revision copy if from-revision flag is passed. * Fixed whitespace style issues. * Styled clients and utils to pass pylint. * Finished client.py pylint fixes. * Fixed pylint issues. * Fixed flake8 commands and custom. * Fixed flake issues in src. * Added license header to _sdk_models. * Added confirmation for containerapp delete. * Update helps for identity, revision. Removed env-var alias for set-env-vars. Added name param help. * Removed app-subnet-resource-id. * Updated infrastructure subnet param help. * Check if containerapp resource exists before attempting to delete. * Added check before deleting managed env. * Changed error types to be more specific. * Removed check before deletion. Removed comments. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Reset to 0.1.0 version, remove unneeded options-list * Update min cli core version * Fixed style issues. (#30) Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Fix linter issues * Use custom-show-command * Removed --ids from revision, secret, registry list. * Add linter exclusions * Fix polling on delete containerapp * Fix error handling * Add Container App Service * Fix flake linter * Fix help text * Mark extension as preview * Add python 3.9 and 3.10 as supported * Remove registries and secrets from az containerapp update, in favor of registry and secret subgroup * Fix YAML not working * Move import to inside deserialize function * Dapr moved from Template to Configuration * Use aka.ms link for containerapps yaml * Updated dapr enable/disable to current spec. * Fixed oversight. * Remove revisions-mode from containerapp update * Fixed dapr enable property names. (#47) Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Fix exceptions with using --yaml in containerapp create/update * Rename history msg * Include fqdn in containerapp table output * Added ingress messages. * Revert history msg * Reduced redundant code between revision copy and containerapp update. * Fixed merge issues. * Fixed merge conflicts, moved helper function Co-authored-by: Calvin Chan <calvinch4n@gmail.com> Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> Co-authored-by: Anthony Chu <anthony@anthonychu.ca> Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com> * Fix help for linter * various fixes, helptext (#59) * Fixes (#60) * Updated managed identity + help. (#61) Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Added user-assigned and system-assigned to containerapp create. (#62) Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Bump version to 0.1.1 (#63) * Added more specific MSI help text. (#64) * Added more specific MSI help text. * Updated help text. Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> * Bump to 0.3.0 (#65) Co-authored-by: Haroon Feisal <38823870+haroonf@users.noreply.github.com> Co-authored-by: Haroon Feisal <haroonfeisal@microsoft.com> Co-authored-by: Anthony Chu <anthony@anthonychu.ca> Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
1 parent 4dbb0b7 commit 7c06c70

File tree

7 files changed

+266
-239
lines changed

7 files changed

+266
-239
lines changed

src/containerapp/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
0.3.0
7+
++++++
8+
* Subgroup commands for managed identities: az containerapp identity
9+
610
0.1.0
711
++++++
812
* Initial release for Container App support with Microsoft.App RP.

src/containerapp/azext_containerapp/_help.py

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@
162162
163163
"""
164164

165+
helps['containerapp revision copy'] = """
166+
type: command
167+
short-summary: Create a revision based on a previous revision.
168+
examples:
169+
- name: Create a revision based on a previous revision.
170+
text: |
171+
az containerapp revision copy -n MyContainerapp -g MyResourceGroup --cpu 0.75 --memory 1.5Gi
172+
"""
165173

166174
# Environment Commands
167175
helps['containerapp env'] = """
@@ -176,13 +184,13 @@
176184
- name: Create an environment with an auto-generated Log Analytics workspace.
177185
text: |
178186
az containerapp env create -n MyContainerappEnvironment -g MyResourceGroup \\
179-
--location "Canada Central"
187+
--location eastus2
180188
- name: Create an environment with an existing Log Analytics workspace.
181189
text: |
182190
az containerapp env create -n MyContainerappEnvironment -g MyResourceGroup \\
183191
--logs-workspace-id myLogsWorkspaceID \\
184192
--logs-workspace-key myLogsWorkspaceKey \\
185-
--location "Canada Central"
193+
--location eastus2
186194
"""
187195

188196

@@ -256,6 +264,61 @@
256264
az containerapp env dapr-component remove -g MyResourceGroup --dapr-component-name MyDaprComponentName --name MyEnvironment
257265
"""
258266

267+
# Identity Commands
268+
helps['containerapp identity'] = """
269+
type: group
270+
short-summary: Commands to manage managed identities.
271+
"""
272+
273+
helps['containerapp identity assign'] = """
274+
type: command
275+
short-summary: Assign managed identity to a container app.
276+
long-summary: Managed identities can be user-assigned or system-assigned.
277+
examples:
278+
- name: Assign system identity.
279+
text: |
280+
az containerapp identity assign -n myContainerapp -g MyResourceGroup --system-assigned
281+
- name: Assign user identity.
282+
text: |
283+
az containerapp identity assign -n myContainerapp -g MyResourceGroup --user-assigned myUserIdentityName
284+
- name: Assign user identity (from a different resource group than the containerapp).
285+
text: |
286+
az containerapp identity assign -n myContainerapp -g MyResourceGroup --user-assigned myUserIdentityResourceId
287+
- name: Assign system and user identity.
288+
text: |
289+
az containerapp identity assign -n myContainerapp -g MyResourceGroup --system-assigned --user-assigned myUserIdentityResourceId
290+
"""
291+
292+
helps['containerapp identity remove'] = """
293+
type: command
294+
short-summary: Remove a managed identity from a container app.
295+
examples:
296+
- name: Remove system identity.
297+
text: |
298+
az containerapp identity remove -n myContainerapp -g MyResourceGroup --system-assigned
299+
- name: Remove user identity.
300+
text: |
301+
az containerapp identity remove -n myContainerapp -g MyResourceGroup --user-assigned myUserIdentityName
302+
- name: Remove system and user identity (from a different resource group than the containerapp).
303+
text: |
304+
az containerapp identity remove -n myContainerapp -g MyResourceGroup --system-assigned --user-assigned myUserIdentityResourceId
305+
- name: Remove all user identities.
306+
text: |
307+
az containerapp identity remove -n myContainerapp -g MyResourceGroup --user-assigned
308+
- name: Remove system identity and all user identities.
309+
text: |
310+
az containerapp identity remove -n myContainerapp -g MyResourceGroup --system-assigned --user-assigned
311+
"""
312+
313+
helps['containerapp identity show'] = """
314+
type: command
315+
short-summary: Show managed identities of a container app.
316+
examples:
317+
- name: Show managed identities.
318+
text: |
319+
az containerapp identity show -n myContainerapp -g MyResourceGroup
320+
"""
321+
259322
# Ingress Commands
260323
helps['containerapp ingress'] = """
261324
type: group
@@ -470,7 +533,7 @@
470533

471534
helps['containerapp dapr enable'] = """
472535
type: command
473-
short-summary: Enable Dapr for a container app.
536+
short-summary: Enable Dapr for a container app. Updates existing values.
474537
examples:
475538
- name: Enable Dapr for a container app.
476539
text: |
@@ -479,7 +542,7 @@
479542

480543
helps['containerapp dapr disable'] = """
481544
type: command
482-
short-summary: Disable Dapr for a container app.
545+
short-summary: Disable Dapr for a container app. Removes existing values.
483546
examples:
484547
- name: Disable Dapr for a container app.
485548
text: |

src/containerapp/azext_containerapp/_params.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def load_arguments(self, _):
3434
with self.argument_context('containerapp', arg_group='Container') as c:
3535
c.argument('image', type=str, options_list=['--image', '-i'], help="Container image, e.g. publisher/image-name:tag.")
3636
c.argument('container_name', type=str, help="Name of the container.")
37-
c.argument('cpu', type=float, validator=validate_cpu, help="Required CPU in cores, e.g. 0.5")
38-
c.argument('memory', type=str, validator=validate_memory, help="Required memory, e.g. 1.0Gi")
37+
c.argument('cpu', type=float, validator=validate_cpu, help="Required CPU in cores from 0.25 - 2.0, e.g. 0.5")
38+
c.argument('memory', type=str, validator=validate_memory, help="Required memory from 0.5 - 4.0 ending with \"Gi\", e.g. 1.0Gi")
3939
c.argument('env_vars', nargs='*', help="A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret.")
4040
c.argument('startup_command', nargs='*', options_list=['--command'], help="A list of supported commands on the container that will executed during startup. Space-separated values e.g. \"/bin/queue\" \"mycommand\". Empty string to clear existing values")
4141
c.argument('args', nargs='*', help="A list of container startup command argument(s). Space-separated values e.g. \"-c\" \"mycommand\". Empty string to clear existing values")
@@ -77,14 +77,18 @@ def load_arguments(self, _):
7777
with self.argument_context('containerapp create') as c:
7878
c.argument('traffic_weights', nargs='*', options_list=['--traffic-weight'], help="A list of revision weight(s) for the container app. Space-separated values in 'revision_name=weight' format. For latest revision, use 'latest=weight'")
7979

80+
with self.argument_context('containerapp create', arg_group='Identity') as c:
81+
c.argument('user_assigned', nargs='+', help="Space-separated user identities to be assigned.")
82+
c.argument('system_assigned', help="Boolean indicating whether to assign system-assigned identity.")
83+
8084
with self.argument_context('containerapp scale') as c:
8185
c.argument('min_replicas', type=int, help="The minimum number of replicas.")
8286
c.argument('max_replicas', type=int, help="The maximum number of replicas.")
8387

8488
with self.argument_context('containerapp env') as c:
8589
c.argument('name', name_type, help='Name of the Container Apps environment.')
8690
c.argument('resource_group_name', arg_type=resource_group_name_type)
87-
c.argument('location', arg_type=get_location_type(self.cli_ctx), help='Location of resource. Examples: Canada Central, North Europe')
91+
c.argument('location', arg_type=get_location_type(self.cli_ctx), help='Location of resource. Examples: eastus2, northeurope')
8892
c.argument('tags', arg_type=tags_type)
8993

9094
with self.argument_context('containerapp env', arg_group='Log Analytics') as c:
@@ -112,6 +116,13 @@ def load_arguments(self, _):
112116
with self.argument_context('containerapp env show') as c:
113117
c.argument('name', name_type, help='Name of the Container Apps Environment.')
114118

119+
with self.argument_context('containerapp identity') as c:
120+
c.argument('user_assigned', nargs='+', help="Space-separated user identities.")
121+
c.argument('system_assigned', help="Boolean indicating whether to assign system-assigned identity.")
122+
123+
with self.argument_context('containerapp identity remove') as c:
124+
c.argument('user_assigned', nargs='*', help="Space-separated user identities. If no user identities are specified, all user identities will be removed.")
125+
115126
with self.argument_context('containerapp github-action add') as c:
116127
c.argument('repo_url', help='The GitHub repository to which the workflow file will be added. In the format: https://github.com/<owner>/<repository-name>')
117128
c.argument('token', help='A Personal Access Token with write access to the specified repository. For more information: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line')
@@ -144,14 +155,11 @@ def load_arguments(self, _):
144155
with self.argument_context('containerapp ingress traffic') as c:
145156
c.argument('traffic_weights', nargs='*', options_list=['--traffic-weight'], help="A list of revision weight(s) for the container app. Space-separated values in 'revision_name=weight' format. For latest revision, use 'latest=weight'")
146157

147-
with self.argument_context('containerapp secret set') as c:
158+
with self.argument_context('containerapp secret') as c:
148159
c.argument('secrets', nargs='+', options_list=['--secrets', '-s'], help="A list of secret(s) for the container app. Space-separated values in 'key=value' format.")
149-
150-
with self.argument_context('containerapp secret show') as c:
151160
c.argument('secret_name', help="The name of the secret to show.")
152-
153-
with self.argument_context('containerapp secret remove') as c:
154161
c.argument('secret_names', nargs='+', help="A list of secret(s) for the container app. Space-separated secret values names.")
162+
c.argument('show_values', help='Show the secret values.')
155163

156164
with self.argument_context('containerapp env dapr-component') as c:
157165
c.argument('dapr_app_id', help="The Dapr app ID.")

src/containerapp/azext_containerapp/_validators.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ def _is_number(s):
1616

1717

1818
def validate_memory(namespace):
19-
memory = namespace.memory
20-
21-
if memory is not None:
19+
if namespace.memory is not None:
2220
valid = False
2321

24-
if memory.endswith("Gi"):
25-
valid = _is_number(memory[:-2])
22+
if not namespace.memory.endswith("Gi"):
23+
namespace.memory = namespace.memory.rstrip()
24+
namespace.memory += "Gi"
25+
26+
valid = _is_number(namespace.memory[:-2])
2627

2728
if not valid:
2829
raise ValidationError("Usage error: --memory must be a number ending with \"Gi\"")

src/containerapp/azext_containerapp/commands.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ def load_command_table(self, _):
6262
g.custom_command('set', 'create_or_update_dapr_component')
6363
g.custom_command('remove', 'remove_dapr_component')
6464

65+
with self.command_group('containerapp identity') as g:
66+
g.custom_command('assign', 'assign_managed_identity', supports_no_wait=True, exception_handler=ex_handler_factory())
67+
g.custom_command('remove', 'remove_managed_identity', supports_no_wait=True, exception_handler=ex_handler_factory())
68+
g.custom_show_command('show', 'show_managed_identity')
69+
6570
with self.command_group('containerapp github-action') as g:
6671
g.custom_command('add', 'create_or_update_github_action', exception_handler=ex_handler_factory())
6772
g.custom_show_command('show', 'show_github_action', exception_handler=ex_handler_factory())

0 commit comments

Comments
 (0)