steampipe plugin install azure

Table: azure_app_service_web_app_slot - Query Azure App Service Web App Slots using SQL

Azure App Service Web App Slots are live apps with their own hostnames. They are part of Azure App Service and are designed to help developers handle app deployments. With slots, you can deploy your apps in a controlled manner and avoid downtime.

Table Usage Guide

The azure_app_service_web_app_slot table provides insights into Azure App Service Web App Slots. As a developer or DevOps engineer, you can use this table to get detailed information about each slot, including its configuration, status, and metadata. This can be particularly useful when managing app deployments and ensuring smooth transitions between different versions of your app.

Examples

Basic info

Explore which web app slots are currently active within the Azure App Service. This allows you to assess their status, identify the ones that have been recently modified, and understand their configuration for better management and optimization.

select
name,
app_name,
id,
kind,
state,
type,
last_modified_time_utc,
repository_site_name,
enabled
from
azure_app_service_web_app_slot;
select
name,
app_name,
id,
kind,
state,
type,
last_modified_time_utc,
repository_site_name,
enabled
from
azure_app_service_web_app_slot;

List slots where the apps are enabled

Examine the active slots within Azure's app service to understand where applications are currently operational. This is useful for managing resources, ensuring optimal app performance, and identifying potential areas for scaling or re-allocation.

select
name,
app_name,
state,
type,
reserved,
server_farm_id,
target_swap_slot enabled
from
azure_app_service_web_app_slot
where
enabled;
select
name,
app_name,
state,
type,
reserved,
server_farm_id,
target_swap_slot,
enabled
from
azure_app_service_web_app_slot
where
enabled = 1;

List slots that accept HTTP traffic (i.e only HTTPS is disabled)

Determine the areas in your Azure App Service where only HTTP traffic is allowed, which could potentially expose your web applications to security risks. This query is useful to identify these areas and implement necessary security measures to restrict traffic to HTTPS only.

select
name,
https_only,
kind,
region
from
azure_app_service_web_app_slot
where
not https_only;
select
name,
https_only,
kind,
region
from
azure_app_service_web_app_slot
where
https_only = 0;

Host names of each slot

Determine the areas in which your Azure App Service Web App Slots are being utilized. This can help you understand the distribution of your resources across different regions and resource groups, aiding in efficient resource management.

select
name,
host_names,
kind,
region,
resource_group
from
azure_app_service_web_app_slot;
select
name,
host_names,
kind,
region,
resource_group
from
azure_app_service_web_app_slot;

List enabled host names

Determine the areas in which host names are enabled to ensure the proper functioning of your Azure App Service Web App Slots. This allows you to manage and monitor your web applications effectively.

select
name,
id,
type,
kind,
enabled_host_names
from
azure_app_service_web_app_slot;
select
name,
id,
type,
kind,
enabled_host_names
from
azure_app_service_web_app_slot;

Get slot swap status of each slot

This query allows you to monitor the status of slot swaps in your Azure App Service Web App Slots. It's useful for keeping track of your deployment process and ensuring smooth transitions between different versions of your web applications.

select
name,
type,
slot_swap_status ->> 'SlotSwapStatus' as slot_swap_status,
slot_swap_status ->> 'SourceSlotName' as source_slot_name,
slot_swap_status ->> 'DestinationSlotName' as destination_slot_name
from
azure_app_service_web_app_slot;
select
name,
type,
json_extract(slot_swap_status, '$.SlotSwapStatus') as slot_swap_status,
json_extract(slot_swap_status, '$.SourceSlotName') as source_slot_name,
json_extract(slot_swap_status, '$.DestinationSlotName') as destination_slot_name
from
azure_app_service_web_app_slot;

Get site config details of each slot

Explore the configuration details of each slot in your Azure App Service Web App to understand the settings of individual workers and software versions. This can be useful for performance tuning and troubleshooting.

select
name,
id,
site_config ->> 'NumberOfWorkers' as number_of_workers,
site_config ->> 'DefaultDocuments' as DefaultDocuments,
site_config ->> 'NetFrameworkVersion' as NetFrameworkVersion,
site_config ->> 'PhpVersion' as PhpVersion,
site_config ->> 'PythonVersion' as PythonVersion,
site_config ->> 'NodeVersion' as NodeVersion,
site_config ->> 'PowerShellVersion' as PowerShellVersion,
site_config ->> 'LinuxFxVersion' as LinuxFxVersion,
site_config ->> 'WindowsFxVersion' as WindowsFxVersion,
site_config ->> 'RequestTracingEnabled' as RequestTracingEnabled,
site_config ->> 'RequestTracingExpirationTime' as RequestTracingExpirationTime,
site_config ->> 'RemoteDebuggingEnabled' as RemoteDebuggingEnabled,
site_config ->> 'RemoteDebuggingVersion' as RemoteDebuggingVersion,
site_config ->> 'HTTPLoggingEnabled' as HTTPLoggingEnabled,
site_config ->> 'DetailedErrorLoggingEnabled' as DetailedErrorLoggingEnabled,
site_config ->> 'PublishingUsername' as PublishingUsername,
site_config ->> 'AppSettings' as AppSettings,
site_config ->> 'ConnectionStrings' as ConnectionStrings,
site_config ->> 'MachineKey' as MachineKey,
site_config ->> 'HandlerMappings' as HandlerMappings,
site_config ->> 'DocumentRoot' as DocumentRoot
from
azure_app_service_web_app_slot;
select
name,
id,
json_extract(site_config, '$.NumberOfWorkers') as number_of_workers,
json_extract(site_config, '$.DefaultDocuments') as DefaultDocuments,
json_extract(site_config, '$.NetFrameworkVersion') as NetFrameworkVersion,
json_extract(site_config, '$.PhpVersion') as PhpVersion,
json_extract(site_config, '$.PythonVersion') as PythonVersion,
json_extract(site_config, '$.NodeVersion') as NodeVersion,
json_extract(site_config, '$.PowerShellVersion') as PowerShellVersion,
json_extract(site_config, '$.LinuxFxVersion') as LinuxFxVersion,
json_extract(site_config, '$.WindowsFxVersion') as WindowsFxVersion,
json_extract(site_config, '$.RequestTracingEnabled') as RequestTracingEnabled,
json_extract(site_config, '$.RequestTracingExpirationTime') as RequestTracingExpirationTime,
json_extract(site_config, '$.RemoteDebuggingEnabled') as RemoteDebuggingEnabled,
json_extract(site_config, '$.RemoteDebuggingVersion') as RemoteDebuggingVersion,
json_extract(site_config, '$.HTTPLoggingEnabled') as HTTPLoggingEnabled,
json_extract(site_config, '$.DetailedErrorLoggingEnabled') as DetailedErrorLoggingEnabled,
json_extract(site_config, '$.PublishingUsername') as PublishingUsername,
json_extract(site_config, '$.AppSettings') as AppSettings,
json_extract(site_config, '$.ConnectionStrings') as ConnectionStrings,
json_extract(site_config, '$.MachineKey') as MachineKey,
json_extract(site_config, '$.HandlerMappings') as HandlerMappings,
json_extract(site_config, '$.DocumentRoot') as DocumentRoot
from
azure_app_service_web_app_slot;

Schema for azure_app_service_web_app_slot

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
app_nametext=The name of the application.
availability_statetextManagement information availability state for the app. Possible values include: 'Normal', 'Limited', 'DisasterRecoveryMode'.
client_affinity_enabledbooleanTrue to enable client affinity; false to stop sending session affinity cookies, which route client requests in the same session to the same instance. Default is true.
client_cert_exclusion_pathstextClient certificate authentication comma-separated exclusion paths.
client_cert_modetextThis composes with ClientCertEnabled setting. ClientCertEnabled: false means ClientCert is ignored. ClientCertEnabled: true and ClientCertMode: Required means ClientCert is required.ClientCertEnabled: true and ClientCertMode: Optional means ClientCert is optional or accepted. Possible values include: 'Required', 'Optional'.
cloud_environmenttextThe Azure Cloud Environment.
container_sizebigintSize of the function container.
custom_domain_verification_idtextUnique identifier that verifies the custom domains assigned to the app. The customer will add this ID to a text record for verification.
default_host_nametextDefault hostname of the app.
enabledbooleanIndicates wheather the app is enabled.
enabled_host_namesjsonbEnabled hostnames for the app. Hostnames need to be assigned (see HostNames) AND enabled. Otherwise, the app is not served on those hostnames.
host_name_ssl_statesjsonbHostname SSL states are used to manage the SSL bindings for app's hostnames.
host_namesjsonbHostnames associated with the app.
host_names_disabledbooleanTrue to disable the public hostnames of the app; otherwise, false. If true, the app is only accessible via API management process.
hosting_environment_profilejsonbApp Service Environment to use for the app.
https_onlybooleanConfigures a web site to accept only https requests.
hyper_vbooleanHyper-V sandbox.
idtextResource ID of the app slot.
identityjsonbManaged service identity.
is_default_containerbooleanTrue if the app is a default container; otherwise, false.
is_xenonbooleanObsolete: Hyper-V sandbox.
kindtextContains the kind of the resource.
last_modified_time_utctimestamp with time zoneLast time the app was modified, in UTC.
nametext=Resource Name.
outbound_ip_addressestextList of IP addresses that the app uses for outbound connections (e.g. database access). Includes VIPs from tenants that site can be hosted with current settings.
possible_outbound_ip_addressestextList of IP addresses that the app uses for outbound connections (e.g. database access). Includes VIPs from all tenants except dataComponent.
redundancy_modetextSite redundancy mode. Possible values include: 'RedundancyModeNone', 'RedundancyModeManual', 'RedundancyModeFailover', 'RedundancyModeActiveActive', 'RedundancyModeGeoRedundant'.
regiontextThe Azure region/location in which the resource is located.
repository_site_nametextName of the repository site.
reservedbooleanTrue if reserved; otherwise, false.
resource_grouptext=The resource group which holds this resource.
scm_site_also_stoppedbooleanTrue to stop SCM (KUDU) site when the app is stopped; otherwise, false. The default is false.
server_farm_idtextResource ID of the associated App Service plan, formatted as: '/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}'.
site_configjsonbConfiguration of the app.
site_config_resourcejsonbConfiguration of an app, such as platform version and bitness, default documents, virtual applications, Always On, etc.
slot_swap_statusjsonbStatus of the last deployment slot swap operation.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statetextCurrent state of the app.
subscription_idtext=, !=, ~~, ~~*, !~~, !~~*The Azure Subscription ID in which the resource is located.
suspended_tilltimestamp with time zoneApp suspended till in case memory-time quota is exceeded.
tagsjsonbA map of tags for the resource.
target_swap_slottextSpecifies which deployment slot this app will swap into.
titletextTitle of the resource.
traffic_manager_host_namesjsonbAzure Traffic Manager hostnames associated with the app.
typetextResource type.
usage_statetextState indicating whether the app has exceeded its quota usage. Read-only. Possible values include: 'UsageStateNormal', 'UsageStateExceeded'.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- azure

You can pass the configuration to the command with the --config argument:

steampipe_export_azure --config '<your_config>' azure_app_service_web_app_slot