Editar

Partilhar via


New-AzBatchResourceFile

Creates a Resource File for usage by New-AzBatchTask.

Syntax

New-AzBatchResourceFile
   -HttpUrl <String>
   -FilePath <String>
   [-FileMode <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzBatchResourceFile
   [-FilePath <String>]
   [-FileMode <String>]
   [-BlobPrefix <String>]
   -StorageContainerUrl <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzBatchResourceFile
   [-FilePath <String>]
   [-FileMode <String>]
   -AutoStorageContainerName <String>
   [-BlobPrefix <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Creates a Resource File for usage by New-AzBatchTask.

Examples

Example 1: Create a resource file from an HTTP URL pointing at a single file

$file = New-AzBatchResourceFile -HttpUrl "https://testacct.blob.core.windows.net/" -FilePath "file1"
New-AzBatchTask -JobId "Job-000001" -Id "Task23" -CommandLine "cmd /c dir /s" -ResourceFiles $file -BatchContext $Context

Creates a PSResourceFile referencing an HTTP url.

Example 2: Create a resource file from an Azure Storage container URL

$file = New-AzBatchResourceFile -StorageContainerUrl "https://testacct.blob.core.windows.net/mycontainer" -FilePath "myfolder"
New-AzBatchTask -JobId "Job-000001" -Id "Task23" -CommandLine "cmd /c dir /s" -ResourceFiles $file -BatchContext $Context

Creates a PSResourceFile referencing an Azure Storage container URL. All files in the container will be downloaded to the specified folder.

Example 3: Create a resource file from an Auto Storage container name

$file = New-AzBatchResourceFile -AutoStorageContainerName "mycontainer" -FilePath "myfolder"
New-AzBatchTask -JobId "Job-000001" -Id "Task23" -CommandLine "cmd /c dir /s" -ResourceFiles $file -BatchContext $Context

Creates a PSResourceFile referencing an Auto Storage container name. All files in the container will be downloaded to the specified folder.

Parameters

-AutoStorageContainerName

The storage container name in the auto storage account.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-BlobPrefix

Gets the blob prefix to use when downloading blobs from an Azure Storage container. Only the blobs whose names begin with the specified prefix will be downloaded. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FileMode

Gets the file permission mode attribute in octal format. This property is applicable only if the resource file is downloaded to a Linux node. If this property is not specified for a Linux node, then the default value is 0770.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FilePath

The location on the compute node to which to download the file(s), relative to the task's working directory. If the HttpUrl parameter is specified, the FilePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the AutoStorageContainerName or StorageContainerUrl parameters are specified, FilePath is optional and is the directory to download the files to. In the case where FilePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified FilePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..').

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-HttpUrl

The URL of the file to download. If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-StorageContainerUrl

The URL of the blob container within Azure Blob Storage. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading blobs from the container. There are two ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the container, or set the ACL for the container to allow public access.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

PSResourceFile