-
Notifications
You must be signed in to change notification settings - Fork 1
Adding cmds & tests for Container app certs & domains #107
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
Changes from 83 commits
1de51ee
7735595
2e1be89
5fcd785
a1929c8
df5cc99
0dedf19
1474d69
5afc2b1
77dcaa0
5cc0aa8
1f1b31a
7f70e2f
fa539a8
f935df8
7da2e9a
fcc3d87
cb6820e
f6efbd2
4e805bf
7f7f1fe
3d794b3
e87accc
552850f
b86d217
31002f8
c292ac9
b9fce25
077bf20
c100f1f
44faaf7
197913a
595cdf5
272146b
988d901
e935bf2
50617e1
757dcf4
cbeac7a
44aa7ff
a016f35
c59d257
bd2cc8b
2b58d27
668b7d9
25843f1
612d1a5
900e7b6
6710636
50e0754
d53550b
66878c7
37627de
5f5308e
7b0bd7d
c534455
3e576de
724249a
a1ce4dd
4fc7267
a8a6ac1
5570ad9
2ccbce0
34aabca
6b3468a
53ddc45
711bbd4
65cb30c
13f217a
e86e089
8960d75
a8737a0
1165dc9
a4590f4
1b8c7e0
40ca5b9
4e7c369
0b15002
34eab57
0a32abd
af7f143
7c6b49e
61db16e
75d1323
2e6f013
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -423,6 +423,38 @@ | |
| az containerapp env storage remove -g MyResourceGroup --storage-name MyStorageName -n MyEnvironment | ||
| """ | ||
|
|
||
| # Certificates Commands | ||
| helps['containerapp env certificate'] = """ | ||
| type: group | ||
| short-summary: Commands to manage certificates for the Container Apps environment. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The usage of this ACA should be consistent across all help - since it is the name of the service. Looks like other commands call it 'container app' so please check & update all accordingly.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For environment level operations, other commands like |
||
| """ | ||
|
|
||
| helps['containerapp env certificate list'] = """ | ||
| type: command | ||
| short-summary: List certificates for an environment. | ||
| examples: | ||
| - name: List certificates for an environment. | ||
| text: | | ||
| az containerapp env certificate list -g MyResourceGroup --name MyEnvironment | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't list command take a certificate name or ID as an input as well. Can you add more sample help commands here on usage? |
||
| """ | ||
|
|
||
| helps['containerapp env certificate upload'] = """ | ||
| type: command | ||
| short-summary: Add or update a certificate. | ||
| examples: | ||
| - name: Add or update a certificate. | ||
| text: | | ||
| az containerapp env certificate upload -g MyResourceGroup --name MyEnvironment -file MyFilepath | ||
| """ | ||
|
|
||
| helps['containerapp env certificate delete'] = """ | ||
| type: command | ||
| short-summary: Delete a certificate from the Container Apps environment. | ||
| examples: | ||
| - name: Delete a certificate from the Container Apps environment. | ||
| text: | | ||
| az containerapp env certificate delete -g MyResourceGroup --name MyEnvironment --certificate-name MyCertificate | ||
|
||
| """ | ||
|
|
||
| # Identity Commands | ||
| helps['containerapp identity'] = """ | ||
|
|
@@ -714,3 +746,32 @@ | |
| text: | | ||
| az containerapp dapr disable -n MyContainerapp -g MyResourceGroup | ||
| """ | ||
|
|
||
| # custom domain Commands | ||
| helps['containerapp ssl upload'] = """ | ||
| type: command | ||
| short-summary: Upload certificate to a managed environment, add hostname to an app in that environment, and bind the certificate to the hostname | ||
| """ | ||
|
|
||
| helps['containerapp hostname'] = """ | ||
| type: group | ||
| short-summary: Commands to manage hostnames of a container app. | ||
| """ | ||
|
|
||
| helps['containerapp hostname delete'] = """ | ||
| type: command | ||
| short-summary: Delete hostnames from a container app. | ||
| examples: | ||
| - name: Delete secrets from a container app. | ||
| text: | | ||
| az containerapp hostname delete -n MyContainerapp -g MyResourceGroup --hostname MyHostname | ||
| """ | ||
|
|
||
| helps['containerapp hostname list'] = """ | ||
| type: command | ||
| short-summary: List the hostnames of a container app. | ||
| examples: | ||
| - name: List the hostnames of a container app. | ||
| text: | | ||
| az containerapp hostname list -n MyContainerapp -g MyResourceGroup | ||
| """ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,6 +181,14 @@ | |
| "tags": None | ||
| } | ||
|
|
||
| ContainerAppCertificate = { | ||
|
||
| "location": None, | ||
| "properties": { | ||
| "password": None, | ||
| "value": None | ||
| } | ||
| } | ||
|
|
||
| DaprComponent = { | ||
| "properties": { | ||
| "componentType": None, # String | ||
|
|
@@ -232,6 +240,22 @@ | |
| "subscriptionId": None # str | ||
| } | ||
|
|
||
| ContainerAppCustomDomainEnvelope = { | ||
| "properties": { | ||
| "configuration": { | ||
| "ingress": { | ||
| "customDomains": None | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ContainerAppCustomDomain = { | ||
| "name": None, | ||
| "bindingType": "SniEnabled", | ||
| "certificateId": None | ||
| } | ||
|
|
||
| AzureFileProperties = { | ||
| "accountName": None, | ||
| "accountKey": None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,6 +149,19 @@ def load_arguments(self, _): | |
| with self.argument_context('containerapp env show') as c: | ||
| c.argument('name', name_type, help='Name of the Container Apps Environment.') | ||
|
|
||
| with self.argument_context('containerapp env certificate upload') as c: | ||
| c.argument('certificate_file', options_list=['--certificate-file', '-file'], help='The filepath of the .pfx or .pem file') | ||
| c.argument('certificate_name', options_list=['--certificate-name', '-cert'], help='Name of the certificate which should be unique within the Container Apps environment.') | ||
| c.argument('certificate_password', options_list=['--password', '-p'], help='The certificate file password') | ||
|
|
||
| with self.argument_context('containerapp env certificate list') as c: | ||
| c.argument('certificate_name', options_list=['--certificate-name', '-cert'], help='Name of the certificate which is unique within the Container Apps environment.') | ||
| c.argument('thumbprint', options_list=['--thumbprint', '-tp'], help='Thumbprint of the certificate.') | ||
|
|
||
| with self.argument_context('containerapp env certificate delete') as c: | ||
| c.argument('certificate_name', options_list=['--certificate-name', '-cert'], help='Name of the certificate which is unique within the Container Apps environment.') | ||
| c.argument('thumbprint', options_list=['--thumbprint', '-tp'], help='Thumbprint of the certificate.') | ||
|
|
||
| with self.argument_context('containerapp env storage') as c: | ||
| c.argument('name', id_part=None) | ||
| c.argument('storage_name', help="Name of the storage.") | ||
|
|
@@ -257,3 +270,19 @@ def load_arguments(self, _): | |
| c.argument('service_principal_client_id', help='The service principal client ID. Used by Github Actions to authenticate with Azure.', options_list=["--service-principal-client-id", "--sp-cid"]) | ||
| c.argument('service_principal_client_secret', help='The service principal client secret. Used by Github Actions to authenticate with Azure.', options_list=["--service-principal-client-secret", "--sp-sec"]) | ||
| c.argument('service_principal_tenant_id', help='The service principal tenant ID. Used by Github Actions to authenticate with Azure.', options_list=["--service-principal-tenant-id", "--sp-tid"]) | ||
|
|
||
| with self.argument_context('containerapp ssl upload') as c: | ||
| c.argument('hostname', help='The custom domain name.') | ||
| c.argument('environment', options_list=['--environment', '-env'], help='Name or resource id of the Container App environment.') | ||
| c.argument('certificate_file', options_list=['--certificate-file', '-file'], help='The filepath of the .pfx or .pem file') | ||
| c.argument('certificate_password', options_list=['--password', '-p'], help='The certificate file password') | ||
| c.argument('certificate_name', options_list=['--certificate-name', '-cert'], help='Name of the certificate which should be unique within the Container Apps environment.') | ||
|
||
|
|
||
| with self.argument_context('containerapp hostname bind') as c: | ||
| c.argument('hostname', help='The custom domain name.') | ||
| c.argument('thumbprint', options_list=['--thumbprint', '-tp'], help='Thumbprint of the certificate.') | ||
| c.argument('certificate', options_list=['--certificate', '-cert'], help='Name or resource id of the certificate.') | ||
| c.argument('environment', options_list=['--environment', '-env'], help='Name or resource id of the Container App environment.') | ||
|
|
||
| with self.argument_context('containerapp hostname delete') as c: | ||
| c.argument('hostname', help='The custom domain name.') | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1011,6 +1011,15 @@ def get_randomized_name(prefix, name=None, initial="rg"): | |
| return default | ||
|
|
||
|
|
||
| def get_randomized_cert_name(thumbprint, prefix, initial="rg"): | ||
|
||
| from random import randint | ||
| cert_name = "{}-{}-{}-{:04}".format(prefix[:14], initial[:14], thumbprint[:4].lower(), randint(0, 9999)) | ||
| for c in cert_name: | ||
| if not (c.isalnum() or c == '-' or c == '.'): | ||
| cert_name.replace(c, '-') | ||
| return cert_name.lower() | ||
|
|
||
|
|
||
| def _set_webapp_up_default_args(cmd, resource_group_name, location, name, registry_server): | ||
| from azure.cli.core.util import ConfiguredDefaultSetter | ||
| with ConfiguredDefaultSetter(cmd.cli_ctx.config, True): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.