Edit

Share via


New-AzStorageBlobQueryConfig

Creates a blob query configuration object, which can be used in Get-AzStorageBlobQueryResult.

Syntax

Csv (Default)

New-AzStorageBlobQueryConfig
    [-AsCsv]
    [-RecordSeparator <String>]
    [-ColumnSeparator <String>]
    [-QuotationCharacter <Char>]
    [-EscapeCharacter <Char>]
    [-HasHeader]
    [-AsJob]
    [<CommonParameters>]

Json

New-AzStorageBlobQueryConfig
    [-AsJson]
    [-RecordSeparator <String>]
    [-AsJob]
    [<CommonParameters>]

Description

The New-AzStorageBlobQueryConfig cmdlet creates a blob query configuration object, which can be used in Get-AzStorageBlobQueryResult.

Examples

Example 1: Create blob query configures , and query a blob

$inputconfig = New-AzStorageBlobQueryConfig -AsCsv -ColumnSeparator "," -QuotationCharacter """" -EscapeCharacter "\" -RecordSeparator "`n" -HasHeader

$outputconfig = New-AzStorageBlobQueryConfig -AsJson -RecordSeparator "`n"

$queryString = "SELECT * FROM BlobStorage WHERE Name = 'a'"

$result = Get-AzStorageBlobQueryResult -Container $containerName -Blob $blobName -QueryString $queryString -ResultFile "c:\resultfile.json" -InputTextConfiguration $inputconfig -OutputTextConfiguration $outputconfig -Context $ctx

$result
BytesScanned FailureCount BlobQueryError
------------ ------------ --------------
         449            0

This command first create input configuration object as csv, and output configuration object as json, then use the 2 configurations to query blob.

Parameters

-AsCsv

Indicate to create a Blob Query Configuration for CSV.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Csv
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJob

Run cmdlet in the background

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJson

Indicate to create a Blob Query Configuration for Json.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Json
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ColumnSeparator

Optional. The string used to separate columns.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Csv
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EscapeCharacter

Optional. The char used as an escape character.

Parameter properties

Type:

Nullable<T>[Char]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Csv
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HasHeader

Optional. Indicate it represent the data has headers.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Csv
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-QuotationCharacter

Optional. The char used to quote a specific field.

Parameter properties

Type:Char
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Csv
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RecordSeparator

Optional. The string used to separate records.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

PSBlobQueryTextConfiguration