diff --git a/scripts/appgateway/appgw_status.sh b/scripts/appgateway/appgw_status.sh index 825b7635..0a9a8ceb 100755 --- a/scripts/appgateway/appgw_status.sh +++ b/scripts/appgateway/appgw_status.sh @@ -18,7 +18,7 @@ if [[ "$MODE" != "start" && "$MODE" != "stop" ]]; then exit 1 fi -APPLICATION_GATEWAYS=$(get_application_gateways "$2") +APPLICATION_GATEWAYS=$(get_application_gateways) # For each App Gateway found in the function `get_application_gateways` start another loop jq -c '.data[]' <<<$APPLICATION_GATEWAYS | while read application_gateway; do diff --git a/scripts/appgateway/common-functions.sh b/scripts/appgateway/common-functions.sh index 1e606fa7..33ab2e57 100755 --- a/scripts/appgateway/common-functions.sh +++ b/scripts/appgateway/common-functions.sh @@ -18,7 +18,7 @@ function get_application_gateways() { | where type =~ 'microsoft.network/applicationgateways' | where tags.autoShutdown == 'true' $env_selector - | project name, resourceGroup, subscriptionId, ['tags'], properties.provisioningState, ['id'] + | project name, resourceGroup, subscriptionId, ['tags'], properties.operationalState, ['id'] " --first 1000 -o json log "az graph query complete" @@ -32,7 +32,7 @@ function get_application_gateways_details() { SUBSCRIPTION=$(jq -r '.subscriptionId' <<< $application_gateway) BUSINESS_AREA=$( jq -r 'if (.tags.businessArea|ascii_downcase) == "ss" then "cross-cutting" else .tags.businessArea|ascii_downcase end' <<< $application_gateway) STARTUP_MODE=$(jq -r '.tags.startupMode' <<< $application_gateway) - APPLICATION_GATEWAY_STATE=$(jq -r '.properties_provisioningState' <<< $application_gateway) + APPLICATION_GATEWAY_STATE=$(jq -r '.properties_operationalState' <<< $application_gateway) } function appgateway_state_messages() { diff --git a/scripts/sqlmi/sqlmistatus.sh b/scripts/sqlmi/sqlmistatus.sh index f2528aac..9ff956ea 100755 --- a/scripts/sqlmi/sqlmistatus.sh +++ b/scripts/sqlmi/sqlmistatus.sh @@ -18,7 +18,14 @@ if [[ "$MODE" != "start" && "$MODE" != "stop" ]]; then exit 1 fi -MI_SQL_SERVERS=$(get_sql_mi_servers "$2") +MI_SQL_SERVERS=$(get_sql_mi_servers) +mi_sql_server_count=$(jq -c -r '.count' <<< $MI_SQL_SERVERS) + +#Cancel check process if there are no auto-shutdown resources +if [[ $mi_sql_server_count -eq 0 ]]; then + ts_echo_color RED "No SQL Managed Instances found, nothing to check" + exit 0 +fi # For each App Gateway found in the function `get_application_gateways` start another loop jq -c '.[]' <<<$MI_SQL_SERVERS | while read server; do