簡體   English   中英

無法在 azure 批處理 VM 中獲取環境變量

[英]Unable to get environment variable in azure batch VM

這是我的 Azure 批處理配置,我試圖從 此處此處的microsoft 教程中創建

我試圖在這里定義環境變量

                CloudPool pool = batchClient.PoolOperations.CreatePool(
                    poolId: PoolId,
                    targetDedicatedComputeNodes: PoolNodeCount,
                    virtualMachineSize: PoolVMSize,
                    virtualMachineConfiguration: vmConfiguration);

                // Specify the application and version to install on the compute nodes
                pool.ApplicationPackageReferences = new List<ApplicationPackageReference>
                {
                    new ApplicationPackageReference {
                        ApplicationId = "7Zip",
                        Version = "19.00" }
                };

                // Commit the pool so that it's created in the Batch service. As the nodes join
                // the pool, the specified application package is installed on each.
                await pool.CommitAsync();


                    CloudJob job = batchClient.JobOperations.CreateJob();
                    job.Id = JobId;
                    job.PoolInformation = new PoolInformation { PoolId = PoolId };

                    await job.CommitAsync();
                    string taskId = "blendertask01";
                    string commandLine =
                        @"cmd /c echo %AZ_BATCH_APP_PACKAGE_7Zip%";
                    CloudTask blenderTask = new CloudTask(taskId, commandLine);
                    batchClient.JobOperations.AddTask(JobId, blenderTask);

我期待cmd /c echo %AZ_BATCH_APP_PACKAGE_7Zip%的輸出為我提供可以找到我的應用程序 7zip 的路徑,以便我可以安裝它,但我不明白。 相反,我得到%AZ_BATCH_APP_PACKAGE_7Zip%

我們應該指定版本而不是使用AZ_BATCH_APP_PACKAGE_7Zip因此它會變成%AZ_BATCH_APP_PACKAGE_7Zip#19.00%\\7z1900-x64.exe

這個信息沒有明確定義但是經過幾次點擊和嘗試后我發現了它

在此處輸入圖片說明

此外,當我們使用遠程帳戶登錄時,環境變量不可見。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM