我想编写一个使用azure power shell运行的脚本来自动添加Web应用程序配置
Azure> MyWebApp>应用程序设置>应用程序设置
它看起来像key ="value"
我写这个脚本
###########################
# MyApp Config Automation #
###########################
#Begin
$subscriptionName="MySubscriptionName"
$webSiteName="MyWebAppName"
$storageAccountName="StorageAccountName"
########################################
$userName = "myaccount@outlook.com"
$securePassword = ConvertTo-SecureString -String "mypass" -AsPlainText -Force
#####################################
$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword)
#####################################
Add-AzureAccount -Credential $cred
Select-AzureSubscription -SubscriptionName $subscriptionName -Default
#####################################
Get-AzureWebsite -Name $webSiteName
#End
Run Code Online (Sandbox Code Playgroud)
但我知道上面的脚本只是获取我的Web应用程序,现在我需要访问MyWebApp>应用程序设置>应用程序设置并给出我的新应用程序设置的脚本文件/数组,并检查脚本是否有任何新的应用程序设置键它会将它添加到App Settings,如果有任何现有的键,它将覆盖它的值.什么是步骤或APIS或我能用天蓝色电源壳做到这一点?
编辑:此脚本可以自动创建新的Web应用程序并向其添加应用程序设置:
##############################################
# Creating website and Adding Configs Script #
##############################################
$webSiteName="mywebsite"
$storageAccountName="storageaccount"
$subscriptionName="mysubsc"
$userName = "myaccount"
$securePassword = ConvertTo-SecureString -String "mypass" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword) …Run Code Online (Sandbox Code Playgroud) 我试图Install-Module Azure在PowerShell中安装Azure .我收到以下错误:
PS C:\Windows\system32> Install-Module Azure
Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is corre
ct and try again.
At line:1 char:1
+ Install-Module Azure
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
为什么PS无法识别基本的安装模块?没有这个,我甚至无法安装Azure.我该怎么办?
在Azure Classic/Service Management中,Get-AzureSubscription将在租户中提供订阅列表,其中包含哪个订阅是最新的.
还有一个Get-AzureSubscription -Current标志可以为您提供当前订阅.
有没有办法在AzureRM.Profile中找到当前订阅?
我正在寻找一种方法来使用Azure PowerShell命令为Azure应用服务(以前的Azure网站)进行部署交换.我见过的所有帖子都说使用命令
Move-Deployment -ServiceName
Run Code Online (Sandbox Code Playgroud)
但这似乎只适用于云服务以及生产和分段预定义插槽之间的交换.
我有一个我已定义的部署插槽的网站,我可以使用以下命令获取有关该网站的信息,但我不知道如何交换它:
Get-AzureWebsite -Name "sitenamehere" -Slot test
Run Code Online (Sandbox Code Playgroud) 我需要通过cmdlet代码找到已安装的Azure PowerShell版本.如何找到Azure PowerShell版本?
注意:除了cmdlet代码之外,也欢迎使用.
我正在尝试验证ResourceGroup是否存在所以我认为以下代码应返回true或false,但它不输出任何内容.
$RSGtest = Find-AzureRmResource | Format-List ResourceGroupName | get-unique
$RSGtest -Match "$myResourceGroupName"
Run Code Online (Sandbox Code Playgroud)
为什么我没有得到任何输出?
我有各种脚本,我曾经在包装器中运行,允许我处理诸如检查我有一个有效连接之类的事情,并询问用户当前选择的连接/订阅是否是他们想要在运行之前运行脚本的那个等等
经典命令具有Clear-AzureProfile,它允许我从脚本运行它并有效地断开连接,以便在不调用Add-AzureAccount的情况下不能再次使用它.
使用RM cmdlet我只能找到Login-AzureRmAccount但是一旦我登录了......我该如何调用logout?
似乎没有Logout-AzureRMAccount或Remove-AzureRMAccount,Clear-AzureProfile无效.
我运行一个开发工作站并连接到几个不同的客户端订阅,所以希望能够破坏连接,而不是只是在其顶部调用另一个登录(如果登录失败,我仍然会设置旧的连接,这对于我)
我刚刚记录了这个:https://msdn.microsoft.com/en-us/library/mt619248.aspx,因为它看起来可能缺少命令的文档
使用 Azure Pipelines PowerShell 任务构建时,我试图将develop分支合并到分支master。
但是在执行命令时git push,我收到此错误:
致命:无法读取“ https://OrganizationName@dev.azure.com ”的密码:终端提示已禁用
代码存储库是“Azure Repos Git”。
git checkout -b master
git config --global user.email "xxxxxxx@xxxx.xxx"
git config --global user.name "xxxxx"
git merge origin/develop
git push origin master
Run Code Online (Sandbox Code Playgroud)
在引用了一些 URL 之后,我创建了个人访问令牌,并将推送命令修改为git push https://PAT@dev.azure.com/OrganizationName,但它仍然无法正常工作。
如果您找到解决此问题的方法,请告诉我。
git azure-powershell azure-devops azure-pipelines-build-task azure-pipelines
我今天将 Az Powershell 升级到 4.6.1 并开始看到以下警告。我的问题是我应该如何处理这个警告?我可以将警告静音,但这根本无法帮助我为这一重大变化做好准备。我检查了 Az 4.6.1 Microsoft 文档,他们告诉我我应该仍然使用 SecretValueText 并且没有提供关于弃用或任何其他获取秘密值的替代方法的类似警告。那么我使用 SecretValueText 读取 KeyVault 机密的 powershell 的更新路径是什么?
WARNING: Breaking changes in the cmdlet 'Get-AzKeyVaultSecret' :
WARNING: - "The output type 'Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret' is changing"
- The following properties in the output type are being deprecated :
'SecretValueText'
WARNING: Note :The change is expected to take effect from the version : '3.0.0'
WARNING: - "The output type 'Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultSecret' is changing"
- The following properties in the output type are being …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用"Self"发行者在 KeyVault中创建自签名证书.
$policy = New-AzureKeyVaultCertificatePolicy -SubjectName "CN=$($certificateName)" -IssuerName "Self" -ValidityInMonths 12
$policy.Exportable = $true
Add-AzureKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy
Run Code Online (Sandbox Code Playgroud)
但是,当获得证书时,它似乎没有私钥.
直接在KeyVault中创建证书似乎没有在线覆盖,在深入研究PowerShell cmdlet的其余API文档和源代码之后,我很难过.
我希望这是我错过的一些简单的事情,因为我希望避免在本地创建证书.
azure-powershell ×10
azure ×6
powershell ×6
azure-devops ×1
cmdlets ×1
git ×1
private-key ×1
version ×1
x509 ×1