简体   繁体   English

如何通过Azure DevOps从Azure删除存储帐户

[英]How to remove a storage account from Azure through Azure DevOps

When I run the Remove-AzureRmStorageAccount command in the Azure PowerShell task I get this error: 在Azure PowerShell任务中运行Remove-AzureRmStorageAccount命令时,出现此错误:

2019-01-24T13:07:29.0148404Z ==============================================================================
2019-01-24T13:07:29.0148533Z Task         : Azure PowerShell
2019-01-24T13:07:29.0148602Z Description  : Run a PowerShell script within an Azure environment
2019-01-24T13:07:29.0148688Z Version      : 3.1.18
2019-01-24T13:07:29.0148847Z Author       : Microsoft Corporation
2019-01-24T13:07:29.0148947Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613749)
2019-01-24T13:07:29.0149050Z ==============================================================================
2019-01-24T13:07:30.2233628Z ##[command]Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\AzureRM\6.13.1\AzureRM.psd1 -Global
2019-01-24T13:07:42.1447157Z ##[command]Clear-AzureRmContext -Scope Process
2019-01-24T13:07:42.7204663Z ##[command]Disable-AzureRmContextAutosave -ErrorAction SilentlyContinue
2019-01-24T13:07:43.0466903Z ##[command]Add-AzureRMAccount -ServicePrincipal -Tenant *** -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope
2019-01-24T13:07:44.1568578Z ##[command] Select-AzureRMSubscription -SubscriptionId XXXXX -TenantId ***
2019-01-24T13:07:44.5546953Z ##[command]& 'D:\a\_temp\XXXXX.ps1' 
2019-01-24T13:07:44.6950579Z ##[command]Disconnect-AzureRmAccount -Scope Process
2019-01-24T13:07:45.1149833Z ##[command]Clear-AzureRmContext -Scope Process
2019-01-24T13:07:45.5569262Z ##[error]Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.

在Azure环境中运行PowerShell脚本

This is the script I run: 这是我运行的脚本:

Remove-AzureRmStorageAccount `
    -ResourceGroupName "myResourceGroupName" `
    -AccountName "mystorageaccountname"
    -Force

Note that I can create the storage account and the blob container in the same way without errors. 请注意,我可以用相同的方式创建存储帐户和blob容器,而不会出错。 This script works without any errors: 该脚本可以正常工作:

if(Get-AzureRmStorageAccountNameAvailability -Name "mystorageaccountname")
{
  New-AzureRmStorageAccount `
    -ResourceGroupName "myResourceGroupName" `
    -AccountName "mystorageaccountname" `
    -Location "West Europe" `
    -SkuName "Standard_LRS"

  New-AzureRmStorageContainer `
    -ResourceGroupName "myResourceGroupName" `
    -AccountName "mystorageaccountname" `
    -ContainerName "my-blob-container" `
    -PublicAccess "Blob"
}

How do I get the remove to work without errors through the Azure DevOps pipeline? 如何通过Azure DevOps管道使删除正常运行而没有错误?

that happens because its asking to confirm deletion ( ##[error]Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available ), you are missing: `. 发生这种情况是因为其要求确认删除( ##[error]Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available ),您丢失了:`。

Remove-AzureRmStorageAccount `
    -ResourceGroupName "myResourceGroupName" `
    -AccountName "mystorageaccountname" ` <<<<< here
    -Force

just retested it, it works without prompts if you supply -Force 刚刚重新测试过,如果您提供-Force ,它将在没有提示的情况下工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 使用 Azure devops 的存储帐户故障转移 - Azure Storage account failover using Azure devops 如何从Azure订阅中删除当前存储帐户? - How to remove current storage account from Azure Subscription? 使用 Azure DevOps 中的 Azure 文件复制任务将数据从存储帐户复制到存储帐户 - Using Azure File Copy Task in Azure DevOps to Copy Data from Storage Account to Storage Account Json to excel from devops to storage account with help of azure function in python - Json to excel from devops to storage account with help of azure function in python 从 Azure Devops Hosted Agents 访问私有存储帐户 - Accessing a private storage account from Azure Devops Hosted Agents Azure DevOps 步骤将 YAML 从 Azure 存储帐户复制到 DevOps 存储库 - Azure Devops step copy YAML from Azure storage account to DevOps repo 删除 Azure 存储帐户密钥 - Remove Azure Storage Account Key 使用Powershell删除Azure存储帐户 - remove azure storage account with powershell 如何从 azure 存储帐户中删除 azure 文件共享旧数据? - How to remove azure file share old data from the azure storage account? Azure 存储帐户防火墙规则阻止使用 azure devops 进行 terraform 部署 - Azure storage account firewall rule prevents terraform deployment with azure devops
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM