我一直在慢慢研究如何使用LogParser 2.2调用PowerShell脚本来转换IIS。我已经决定使用Azure Data Factory Batch Service Custom Activity来运行PowerShell脚本。我已经能够解决在Azure自定义批处理活动中运行PowerShell时出现的许多文件路径问题,但我不能解决这个问题。
目前我只是尝试通过写主机打印环境变量AZ_BATCH_APP_PACKAGE_powershellscripts#1.0,我已经能够打印其他环境变量了,但我相信这个变量末尾的#1.0引起了我所有的悲哀。顺便说一句,1.0是加载到Azure批处理框架
我在Azure中有一个webapp应用,在RG TestRG中有TestApp。我已经创建了一个用于部署的zip,并使用以下powershell脚本
az webapp deployment source config-zip -n "TestApp" -g "TestRG" --src "c:\test\deployfile.zip"
它会给出警告
"az :获取zip部署的scm站点凭据“
然后它会显示以下内容:
Starting zip deployment. This operation can take a while to c
我试图在powershell脚本中自动登录azure,为此,我使用了Microsoft doc 中建议的以下命令
az login --tenant <tenant> --use-device-code
但是脚本在这里暂停,下面警告我们打开浏览器并输入代码。
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <code> to authenticate.
如何在我的powershell脚本中自动登录?
编辑:这篇文章的目的
归根结底,我有一个Powershell脚本,如下所示:
$ErrorActionPreference='Stop'
az group deployment create -g ....
# Error in az group
# More az cli commands
即使在创建az组部署时出现错误,它也会继续执行。如何在出错时停止执行脚本?
我有一个Powershell脚本,它包含从Azure函数运行的az命令
我在requirements.psd1中指定了模块,并启用了主机json托管依赖项。
在我的脚本中,我输入了以下命令
Get-Module -Name Az -ListAvailable
Import-Module Az
安装4.8.0时Get模块返回
然后我收到警告
[Warning] The Function app may be missing a module containing the 'az' command definition. If this command belongs to a m
我尝试过在互联网上搜索,但大多数结果只在PowerShell控制台处于活动状态时人们不小心按下某个键时才会显示。
我面临的问题是,我将Hyper-V对象存储在一个变量中,然后调用该变量。
下面的代码片段来自我的脚本。
$ListDisks = Get-VMHardDiskDrive -VMName $VMName -ControllerType SCSI
"The following table will show which disks have been attached to the VM!" | Write-Host
$ListDisks
Pause
因此,当脚本执
我搞错了
##[error]Could not find the modules: 'Az.Accounts' with Version: '5.1.1'. If the module was recently installed, retry after restarting the Azure Pipelines task agent
在尝试使用多级Yaml运行Azure DevOps管道时,使用自托管代理(Windows2019)
Yaml:
- task: AzurePowerShell@5
displayName: 'Di
我正在使用Powershell中web应用的kudu zip推送部署将web作业部署到Azure应用
我正在使用以下内容:
az login -u <username>
az account set --subscription <subscription_name>
az webapp deployment source config-zip -g <ResourecGroup> -n <WebAppName> --src <pathetozipfile>
but i keep getting the error:
"a
我正在Azure DevOps中创建一个构建管道。我有一个调用文件内部脚本的PowerShell任务--它不是“内联”PowerShell。该脚本需要Az.Accounts模块,所以我添加了Import-Module Az.Accounts。当我运行管道时,我得到以下结果: Import-Module : The specified module 'Az.Accounts' was not loaded because no valid module file was found in any module
directory.
At D:\a\1\s\XXX\XXX\XX