Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
a88b490
use `try_create_application_insights` in custom
domainname Nov 13, 2023
575b29e
create workspace
domainname Nov 14, 2023
7889b6f
create workspace & AI
domainname Nov 15, 2023
a576bcb
Merge branch 'main' into jeffhuang/ai-workspace
domainname Nov 16, 2023
255631b
fix UT
domainname Nov 20, 2023
00ae852
Merge remote-tracking branch 'origin/jeffhuang/ai-workspace' into jef…
domainname Nov 20, 2023
e6cf1f7
fix UT
domainname Nov 20, 2023
63fe631
fix UT
domainname Nov 20, 2023
37b53a3
Add UT
domainname Dec 25, 2023
2d09825
Add History and update version
domainname Dec 28, 2023
a65e481
Merge branch 'main' into jeffhuang/ai-workspace
domainname Dec 28, 2023
406eab6
use `try_create_application_insights` in custom
domainname Nov 13, 2023
e1dcfe2
create workspace
domainname Nov 14, 2023
675bc6b
create workspace & AI
domainname Nov 15, 2023
0a78a96
fix UT
domainname Nov 20, 2023
b5f47bc
[containerapp] `az containerapp create/update`: Support --customized-…
Greedygre Nov 10, 2023
65dc1a1
Introduce App Resiliency & Dapr Component Resiliency (#6967)
yash-nisar Nov 10, 2023
5da5eb3
[containerapp] Give a better error message when customer uses --artif…
daniv-msft Nov 11, 2023
d6823e0
[containerapp] Release version 0.3.44 (#6972)
Greedygre Nov 12, 2023
bf868ae
[Release] Update index.json for extension [ containerapp ]
azclibot Nov 12, 2023
fa681ff
Update baremetalinstance version (#6975)
alexandraavendano Nov 13, 2023
3fb4a2a
Re-record failing source-to-cloud patch tests (#6984)
cormacpayne Nov 14, 2023
e1b3f63
[confcom] initial commit of katapolicygen (#6974)
SethHollandsworth Nov 14, 2023
a2062a9
[Release] Update index.json for extension [ confcom ]
azclibot Nov 14, 2023
a7b25e6
Release 2.22.0 ml cli extension (#6992)
diondrapeck Nov 14, 2023
196748a
[Hilo] Onboard new extension. (#6926)
yuc-Li Nov 14, 2023
8f99aec
[Release] Update index.json for extension [ hdinsightonaks ]
azclibot Nov 14, 2023
1ad3308
[confcom] taking out print statement (#6994)
SethHollandsworth Nov 15, 2023
6c92108
[Release] Update index.json for extension [ confcom ]
azclibot Nov 15, 2023
3d820cc
chore(arcdata): version bump to 1.5.7 (#6991)
arcdatabot Nov 15, 2023
33a389c
Arc Appliance CLI November Release (#7000)
saisankargochhayat Nov 16, 2023
3cb182d
[az fleet] updated help examples (#6995)
Ealianis Nov 16, 2023
deae567
[Release] Update index.json for extension [ fleet ]
azclibot Nov 16, 2023
d7cfd6e
Updating examples and SKU description for Elastic (#7002)
poshett Nov 16, 2023
ddd111d
[Release] Update index.json for extension [ elastic ]
azclibot Nov 16, 2023
fabcd8e
Arc Appliance CLI: 1.0.1 [November Release] [with package bump] (#7003)
saisankargochhayat Nov 16, 2023
ae46984
{AKS} 'az aks nodepool update': Update enum for --os-sku to match all…
hbeberman Nov 16, 2023
1319734
fix UT
domainname Nov 20, 2023
9a9b0ae
fix UT
domainname Nov 20, 2023
0fc4426
Add UT
domainname Dec 25, 2023
bada4c4
Add History and update version
domainname Dec 28, 2023
230ec43
{AKS} Vendor new SDK and bump API version to 2023-10-02-preview (#7001)
FumingZhang Nov 17, 2023
4dd5a31
Adds IoT Operations extension v0.1.0b2 (#7008)
c-ryan-k Nov 18, 2023
ca83865
[Bastion] adding rdp file to temp location and adding auth-type for r…
aavalang Nov 20, 2023
bcb820f
[Release] Update index.json for extension [ bastion ]
azclibot Nov 20, 2023
929e165
{CI} Update policy rules (#7009)
wangzelin007 Nov 20, 2023
ed0148a
{CI} Update pipeline to use Python 3.11 (#7010)
bebound Nov 20, 2023
780de06
Fix param name fix for disk override (#6998)
nascarsayan Nov 21, 2023
fceef51
[Release] Update index.json for extension [ connectedvmware ]
azclibot Nov 21, 2023
f63cf7b
{AKS} az aks update: Remove outbound limit in update description (#7014)
MartinForReal Nov 22, 2023
cede0c7
{AKS} `az aks update`: force `--network-policy=cilium` whenever `--ne…
robogatikov Nov 22, 2023
222f89b
CLI extension for AzureLargeInstance (#6858)
8Gitbrix Nov 22, 2023
02a3f1f
[Release] Update index.json for extension [ azurelargeinstance ]
azclibot Nov 22, 2023
61cddae
[Bastion] add auth type password for rdp and fix line formatting issu…
aavalang Nov 23, 2023
82d6614
[Release] Update index.json for extension [ bastion ]
azclibot Nov 23, 2023
cbe31d2
[AKS] Fix for app routing CLI (#6968)
bosesuneha Nov 27, 2023
9727a13
[Release] Update index.json for extension [ aks-preview ]
azclibot Nov 27, 2023
1808f2a
[containerapp] `az containerapp up`: support create or update contain…
Greedygre Nov 28, 2023
5dfdae2
[ContainerApp] Cloud Build Bugfix - 500 Internal Server Error (Wrong …
snehapar9 Nov 28, 2023
9f37027
[Vm-repair] Fix in az vm repair run --preview parameter (#6973)
haagha Nov 29, 2023
a0c8737
[Release] Update index.json for extension [ vm-repair ]
azclibot Nov 29, 2023
e6e11f4
bump version 0.3.45 (#7039)
Greedygre Nov 29, 2023
fa2fe4d
[Release] Update index.json for extension [ containerapp ]
azclibot Nov 29, 2023
465bc95
APICenter Extension Initial Release (#6918)
arpishahmsft Nov 29, 2023
9cf8f60
[Release] Update index.json for extension [ apic-extension ]
azclibot Nov 29, 2023
9f67705
[StreamAnalytics] Remove Experimental (#6796)
ZengTaoxu Nov 30, 2023
e8cf6ca
[Release] Update index.json for extension [ stream-analytics ]
azclibot Nov 30, 2023
6d3eb09
Connectedk8s - RBAC: Add "arc "mode in Guard for using OBO service an…
vineeth-thumma Nov 30, 2023
eb46c81
[Release] Update index.json for extension [ connectedk8s ]
azclibot Nov 30, 2023
90125f2
removing preview and fixing issue with aad (#7042)
aavalang Nov 30, 2023
4050bf2
[Release] Update index.json for extension [ bastion ]
azclibot Nov 30, 2023
d18fac1
[Containerapp] `az containerapp update`: Fix issue for --min-replicas…
Greedygre Nov 30, 2023
9561cf7
revert connectedk8s 1.5.5 (#7049)
wangzelin007 Nov 30, 2023
61c993a
[Containerapp] `az containerapp create`: Fix BadRequest Error about c…
Greedygre Nov 30, 2023
ddcacfa
Revert "Connectedk8s - RBAC: Add "arc "mode in Guard for using OBO se…
vineeth-thumma Nov 30, 2023
0e9f768
Stack-hci-vm 0.1.8 (#7052)
Arkanayan Nov 30, 2023
82fc2dd
bump version and revert change in scale rule name (#7053)
Greedygre Nov 30, 2023
86ee20e
[Release] Update index.json for extension [ containerapp ]
azclibot Nov 30, 2023
b145f84
{AKS} az aks stop: add warning when private link cluster is stopped (…
levimm Dec 1, 2023
d647f66
[Release] Update index.json for extension [ aks-preview ]
azclibot Dec 1, 2023
bee737f
Include azure storage library in vendored_sdks (#6909)
Cyclam Dec 1, 2023
378bd7a
[Release] Update index.json for extension [ aosm ]
azclibot Dec 1, 2023
acd276a
{Service Connector}: AAD rebranding and fix sql connection (#7041)
xfz11 Dec 1, 2023
e0cac2a
[Release] Update index.json for extension [ serviceconnector-password…
azclibot Dec 1, 2023
d575657
Adding 0.1.2 version of akshybrid cli to fix kubernetes dependency is…
HariPrasadV Dec 1, 2023
72c2846
Added the whl file for 1.0.0 version of aksarc cli (renamed from aksh…
HariPrasadV Dec 1, 2023
ddac756
[Logic] `az logic workflow`: Add new command group `identity` to supp…
Jing-song Dec 1, 2023
a151c22
[Release] Update index.json for extension [ logic ]
azclibot Dec 1, 2023
4a19a69
`az vmware private-cloud list-admin-credentials` bugfix (#7034)
jonathanhe-msft Dec 4, 2023
2c4aa7d
[Release] Update index.json for extension [ vmware ]
azclibot Dec 4, 2023
d49cd54
[Spring] API Portal try out & SCG response cache (#6988)
jiec-msft Dec 4, 2023
ab7b93d
[Release] Update index.json for extension [ spring ]
azclibot Dec 4, 2023
b21cdbd
Update response format for aks mesh get upgrades and revisions comman…
deveshdama Dec 4, 2023
01f32f4
[Quota] Add new commands `az quota request list/show` to support mana…
Jing-song Dec 5, 2023
8e32b12
[Release] Update index.json for extension [ quota ]
azclibot Dec 5, 2023
cbf46e6
Change unversioned image aliases to corresponding URN (#6889)
ReaNAiveD Dec 6, 2023
4a7962e
fix lookup for custom locations rp sp to use appId instead of display…
keystroke Dec 6, 2023
2fcdaa1
Adds IoT Ops extension v0.2.0b1 (#7066)
c-ryan-k Dec 8, 2023
53a48f5
[az vm repair] Win-run-driver script fix (#7061)
haagha Dec 8, 2023
9142455
Pk5/fix feature flag bug (#7064)
Cyclam Dec 8, 2023
e208bba
{Containerapp} Set test region default to northcentralusstage (#7058)
Greedygre Dec 8, 2023
06e317b
[Release] Update index.json for extension [ vm-repair ]
azclibot Dec 8, 2023
c65dd44
Arc Appliance CLI 1.0.2 December Release (#7072)
pkoushik Dec 11, 2023
3274ba2
Connectedk8s - RBAC: Add "arc "mode in Guard for using OBO service an…
vineeth-thumma Dec 11, 2023
2f47352
[k8s-extension] Update extension CLI to v1.5.3 (#7071)
bavneetsingh16 Dec 11, 2023
83aed32
[Release] Update index.json for extension [ connectedk8s ]
azclibot Dec 11, 2023
e11924f
{Attestation} `az attestation signer/policy`: Bump API version from 2…
ZengTaoxu Dec 11, 2023
458b013
[Release] Update index.json for extension [ attestation ]
azclibot Dec 11, 2023
1b278a3
[connectedmachine] release preview version 2023-10-03 (#7032)
yaotongms Dec 11, 2023
0892c09
[Release] Update index.json for extension [ connectedmachine ]
azclibot Dec 11, 2023
2bb6db5
[Release] Update index.json for extension [ k8s-extension ]
azclibot Dec 12, 2023
b09b08c
chore(arcdata): version bump to 1.5.8 (#7076)
arcdatabot Dec 12, 2023
f6ad8bb
Add IoT Extension v0.23.1 (#7078)
c-ryan-k Dec 12, 2023
65bb656
feature: allow to read output for failed jobs (#7067)
kikomiss Dec 13, 2023
6699853
{CI} Fix static analysis (#6509)
wangzelin007 Dec 13, 2023
4e1ace6
{CI} Regenerating breaking change report with only_break=True to cont…
wangzelin007 Dec 13, 2023
935dfb7
chore: releasing az quantum v0.20.0 (#7080)
kikomiss Dec 14, 2023
ce06eeb
[Release] Update index.json for extension [ quantum ]
azclibot Dec 14, 2023
aa9b494
Upgrade Helm for connectedk8s (#6915)
kitnhl Dec 14, 2023
7df94b1
[Release] Update index.json for extension [ connectedk8s ]
azclibot Dec 14, 2023
17f8f1f
[az fleet] Minor style & linter updates to fix checks. (#7092)
Ealianis Dec 18, 2023
efabd34
[Release] Update index.json for extension [ fleet ]
azclibot Dec 18, 2023
7038448
Mircosoft.NetworkCloud Update cli-ext (#7015)
MikePham0630 Dec 18, 2023
5f5d8a1
[Release] Update index.json for extension [ networkcloud ]
azclibot Dec 18, 2023
00bea55
Support --self-contained-interactive-authoring-enabled in integration…
Jingshu918 Dec 18, 2023
21fab1f
[Release] Update index.json for extension [ datafactory ]
azclibot Dec 18, 2023
645dc21
[AKS] Fix for `az aks approuting update` command (#7038)
bosesuneha Dec 18, 2023
91d4530
Added 1.0.2 version of aksarc CLI extension (#7090)
HariPrasadV Dec 19, 2023
e64c0f7
{CI} Add statement for azdev style (#7099)
wangzelin007 Dec 19, 2023
ff931ca
[confcom] updating docs to include new genpolicy info (#7093)
SethHollandsworth Dec 20, 2023
26c0dc1
{CI} Add statement for azdev style (#7101)
wangzelin007 Dec 20, 2023
a39c248
Create commands for 2023-07-01-preview Api version (#7055)
kaushal087 Dec 20, 2023
e34ee86
Properly handle k8s clusters of kind provisioned cluster for connecte…
sidiesen Dec 20, 2023
342046d
upgrade api (#7082)
Jing-song Dec 21, 2023
21b6888
{CI} Update bot workflow (#7091)
wangzelin007 Dec 21, 2023
88fe5e8
[Release] Update index.json for extension [ confcom ]
azclibot Dec 21, 2023
86f258c
[Release] Update index.json for extension [ nsp ]
azclibot Dec 21, 2023
9208023
[Release] Update index.json for extension [ connectedk8s ]
azclibot Dec 21, 2023
1082e80
[Release] Update index.json for extension [ stack-hci ]
azclibot Dec 21, 2023
123a64e
Introduce additional bugfixes, bump CLI extension version (#7111)
sidiesen Dec 22, 2023
5b54863
[Release] Update index.json for extension [ connectedk8s ]
azclibot Dec 22, 2023
3d43960
[devcenter] Update project environment type parameters to be required…
am-lim Dec 22, 2023
7f3a855
[Release] Update index.json for extension [ devcenter ]
azclibot Dec 22, 2023
3f77f40
Added extension support for NNF 4.2 release (#7095)
aytripathi Dec 22, 2023
d8aed41
[Release] Update index.json for extension [ managednetworkfabric ]
azclibot Dec 22, 2023
f35f550
[Spring] Add new params to support auto binding (#7098)
moarychan Dec 25, 2023
0485c2c
[Release] Update index.json for extension [ spring ]
azclibot Dec 25, 2023
b481a9c
[Spring] Support managed component log stream (#7021)
jiec-msft Dec 26, 2023
08442cb
[Application-insights] `az monitor app-insights component`: Add new c…
Jing-song Dec 26, 2023
0b8818a
[Release] Update index.json for extension [ spring ]
azclibot Dec 26, 2023
33a33b1
{AKS} Fix azdev style issues for tests (#7115)
FumingZhang Dec 26, 2023
c632526
{AKS} Replace Workload Identity related functions in aks-preview with…
jiashun0011 Dec 27, 2023
a872c6f
[Release] Update index.json for extension [ aks-preview ]
azclibot Dec 27, 2023
ee091f7
{Monitor-control-service} Data collection migrate (#7120)
AllyW Dec 27, 2023
56a6eba
[Release] Update index.json for extension [ monitor-control-service ]
azclibot Dec 27, 2023
ec66f6a
Merge remote-tracking branch 'origin/jeffhuang/ai-workspace' into jef…
domainname Dec 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Release History
===============

1.19.1
---
* Create workspace-based Application Insights instead, since classic Application Insights will be retired on 29 February 2024.

1.19.0
---
* Add new commands for managed component log streaming `az spring component list`, `az spring component instance list` and `az spring component logs`.
Expand Down
36 changes: 2 additions & 34 deletions src/spring/azext_spring/apm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from msrestazure.tools import parse_resource_id, is_valid_resource_id

from ._utils import get_portal_uri
from .custom import try_create_application_insights
from .vendored_sdks.appplatform.v2023_11_01_preview import models

logger = get_logger(__name__)
Expand Down Expand Up @@ -110,7 +111,7 @@ def _get_connection_string(cmd, resource_group, service_name, location, app_insi

def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location):
try:
created_app_insights = _try_create_application_insights(cmd, resource_group, service_name, location)
created_app_insights = try_create_application_insights(cmd, resource_group, service_name, location)
if created_app_insights:
return created_app_insights.connection_string
except Exception: # pylint: disable=broad-except
Expand Down Expand Up @@ -154,36 +155,3 @@ def _get_app_insights_connection_string(cli_ctx, resource_group, name):
"Application Insights {} under resource group {} was not found.".format(name, resource_group))

return appinsights.connection_string


def _try_create_application_insights(cmd, resource_group, name, location):
creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Apps. ' \
'Please use the Azure Portal to manually create and configure the Application Insights, ' \
'if needed.'

ai_resource_group_name = resource_group
ai_name = name
ai_location = location
ai_properties = {
"name": ai_name,
"location": ai_location,
"kind": "web",
"properties": {
"Application_Type": "web"
}
}

app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient)
appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties)

if not appinsights or not appinsights.connection_string:
logger.warning(creation_failed_warn)
return None

portal_url = get_portal_uri(cmd.cli_ctx)
# We make this success message as a warning to no interfere with regular JSON output in stdout
logger.warning('Application Insights \"%s\" was created for this Azure Spring Apps. '
'You can visit %s/#resource%s/overview to view your '
'Application Insights component', appinsights.name, portal_url, appinsights.id)

return appinsights
36 changes: 2 additions & 34 deletions src/spring/azext_spring/buildpack_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .vendored_sdks.appplatform.v2023_11_01_preview import models
from azure.cli.core.util import sdk_no_wait
from ._utils import get_portal_uri
from .custom import try_create_application_insights
from msrestazure.tools import parse_resource_id, is_valid_resource_id
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.azclierror import InvalidArgumentValueError
Expand Down Expand Up @@ -112,7 +113,7 @@ def _get_connection_string(cmd, resource_group, service_name, location, app_insi
def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location):

try:
created_app_insights = _try_create_application_insights(cmd, resource_group, service_name, location)
created_app_insights = try_create_application_insights(cmd, resource_group, service_name, location)
if created_app_insights:
return created_app_insights.connection_string
except Exception: # pylint: disable=broad-except
Expand Down Expand Up @@ -155,36 +156,3 @@ def _get_app_insights_connection_string(cli_ctx, resource_group, name):
raise ResourceNotFoundError("App Insights {} under resource group {} was not found.".format(name, resource_group))

return appinsights.connection_string


def _try_create_application_insights(cmd, resource_group, name, location):
creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Apps. ' \
'Please use the Azure Portal to manually create and configure the Application Insights, ' \
'if needed.'

ai_resource_group_name = resource_group
ai_name = name
ai_location = location
ai_properties = {
"name": ai_name,
"location": ai_location,
"kind": "web",
"properties": {
"Application_Type": "web"
}
}

app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient)
appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties)

if not appinsights or not appinsights.connection_string:
logger.warning(creation_failed_warn)
return None

portal_url = get_portal_uri(cmd.cli_ctx)
# We make this success message as a warning to no interfere with regular JSON output in stdout
logger.warning('Application Insights \"%s\" was created for this Azure Spring Apps. '
'You can visit %s/#resource%s/overview to view your '
'Application Insights component', appinsights.name, portal_url, appinsights.id)

return appinsights
64 changes: 51 additions & 13 deletions src/spring/azext_spring/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import os
import time
from azure.cli.core._profile import Profile
from azure.core.exceptions import HttpResponseError
from azure.mgmt.loganalytics import LogAnalyticsManagementClient

from ._websocket import WebSocketConnection, recv_remote, send_stdin, EXEC_PROTOCOL_CTRL_C_MSG
from azure.mgmt.cosmosdb import CosmosDBManagementClient
Expand Down Expand Up @@ -49,6 +51,8 @@
NO_PRODUCTION_DEPLOYMENT_SET_ERROR = "This app has no production deployment, use \"az spring app deployment create\" to create a deployment and \"az spring app set-deployment\" to set production deployment."
DELETE_PRODUCTION_DEPLOYMENT_WARNING = "You are going to delete production deployment, the app will be inaccessible after this operation."
LOG_RUNNING_PROMPT = "This command usually takes minutes to run. Add '--verbose' parameter if needed."
APP_INSIGHTS_CREATION_FAILURE_WARNING = 'Unable to create the Application Insights for the Azure Spring Apps. ' \
'Please use the Azure Portal to manually create and configure the Application Insights, if needed.'


def _warn_enable_java_agent(enable_java_agent, **_):
Expand Down Expand Up @@ -1460,26 +1464,26 @@ def _get_connection_string_from_app_insights(cmd, resource_group, app_insights):


def try_create_application_insights(cmd, resource_group, name, location):
creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Apps. ' \
'Please use the Azure Portal to manually create and configure the Application Insights, ' \
'if needed.'

ai_resource_group_name = resource_group
ai_name = name
ai_location = location
workspace = try_create_log_analytics_workspace(cmd, resource_group, name, location)
if workspace is None:
logger.warning(APP_INSIGHTS_CREATION_FAILURE_WARNING)
return None

app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient)
app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient,
api_version='2020-02-02-preview')
ai_properties = {
"name": ai_name,
"location": ai_location,
"location": location,
"kind": "web",
"properties": {
"Application_Type": "web"
"Application_Type": "web",
"Flow_Type": "Bluefield",
"Request_Source": "rest",
"WorkspaceResourceId": workspace.id
}
}
appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties)
appinsights = app_insights_client.components.create_or_update(resource_group, name, ai_properties)
if appinsights is None or appinsights.connection_string is None:
logger.warning(creation_failed_warn)
logger.warning(APP_INSIGHTS_CREATION_FAILURE_WARNING)
return None

portal_url = get_portal_uri(cmd.cli_ctx)
Expand Down Expand Up @@ -1542,6 +1546,40 @@ def app_insights_show(cmd, client, resource_group, name, no_wait=False):
return monitoring_setting_properties


def try_create_log_analytics_workspace(cmd, resource_group, name, location):
client = get_mgmt_service_client(cmd.cli_ctx, LogAnalyticsManagementClient)
workspace = None

try:
workspace = client.workspaces.get(resource_group, name)
except HttpResponseError as err:
if err.status_code != 404:
raise

if workspace is not None:
return workspace

logger.debug("Log Analytics workspace not found. Creating it now...")
properties = {
"location": location,
"properties": {
"sku": {
"name": "PerGB2018"
},
"retentionInDays": 30
}
}
workspace = client.workspaces.begin_create_or_update(resource_group, name, properties).result()

portal_url = get_portal_uri(cmd.cli_ctx)
# We make this success message as a warning to no interfere with regular JSON output in stdout
logger.warning('Log Analytics workspace \"%s\" was created for this Azure Spring Apps. '
'You can visit %s/#resource%s/overview to view your Log Analytics workspace',
workspace.name, portal_url, workspace.id)

return workspace


def app_connect(cmd, client, resource_group, service, name,
deployment=None, instance=None, shell_cmd='/bin/sh'):

Expand Down
28 changes: 24 additions & 4 deletions src/spring/azext_spring/tests/latest/test_asa_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _execute(self, resource_group, name, **kwargs):
self.created_resource = call_args[0][0][2]


class TestSpringCloudCreateEnerprise(BasicTest):
class TestSpringCloudCreateEnterprise(BasicTest):
def test_asc_create_enterprise(self):
self._execute('rg', 'asc', sku=self._get_sku('Enterprise'), disable_app_insights=True)
resource = self.created_resource
Expand Down Expand Up @@ -169,8 +169,18 @@ def test_asa_basic_with_acc(self):
self.assertIsNone(self.dev_tool)


def _workspaces_get_func(*args, **kwargs):
if args[1] == 'asc-with-existing-workspace':
workspace = mock.MagicMock()
workspace.id = 'workspace-id'
return workspace
else:
return None


class TestSpringCloudCreateWithAI(BasicTest):
def _get_ai_client(ctx, type):
def _get_ai_client(ctx, type, api_version=None):
free_mock_client.workspaces.get.side_effect = _workspaces_get_func
ai_create_resource = mock.MagicMock()
ai_create_resource.connection_string = 'fake-connection'
free_mock_client.components.create_or_update.return_value = ai_create_resource
Expand Down Expand Up @@ -205,6 +215,15 @@ def test_asc_create_with_AI_happy_path(self):
self.assertEqual('fake-connection', self.monitoring_settings_resource.properties.app_insights_instrumentation_key)
self.assertEqual(True, self.monitoring_settings_resource.properties.trace_enabled)

def test_asc_create_with_AI_and_existing_workspace(self):
self._execute('rg', 'asc-with-existing-workspace', sku=self._get_sku())
resource = self.created_resource
self.assertEqual('S0', resource.sku.name)
self.assertEqual('Standard', resource.sku.tier)
self.assertEqual(False, resource.properties.zone_redundant)
self.assertEqual('fake-connection', self.monitoring_settings_resource.properties.app_insights_instrumentation_key)
self.assertEqual(True, self.monitoring_settings_resource.properties.trace_enabled)

def test_asc_create_with_AI_key(self):
self._execute('rg', 'asc', sku=self._get_sku(), app_insights_key='my-key')
resource = self.created_resource
Expand All @@ -224,8 +243,8 @@ def test_asc_create_with_AI_name(self):
self.assertEqual(True, self.monitoring_settings_resource.properties.trace_enabled)


class TestSpringCloudCreateEnerpriseWithApplicationInsights(BasicTest):
def _get_application_insights_client(ctx, type):
class TestSpringCloudCreateEnterpriseWithApplicationInsights(BasicTest):
def _get_application_insights_client(ctx, type, api_version=None):
application_insights_create_resource = mock.MagicMock()
application_insights_create_resource.connection_string = 'fake-create-connection-string'

Expand All @@ -242,6 +261,7 @@ def __init__(self, methodName: str = ...):
self.buildpack_binding_resource = None

@mock.patch('azext_spring.buildpack_binding.get_mgmt_service_client', _get_application_insights_client)
@mock.patch('azext_spring.custom.get_mgmt_service_client', _get_application_insights_client)
def _execute(self, resource_group, name, **kwargs):
client = kwargs.pop('client', None) or _get_basic_mock_client()
super()._execute(resource_group, name, client=client, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/spring/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '1.19.0'
VERSION = '1.19.1'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down