title: Passing databaseimport value to Azure DevOps job
body: <p>I am currently writing a YAML script which calls some powershell scripts to export a database from one subscription to bacpac, then import to another.  Because of the tier the databases are running on, this often now fails due to the 60 minute limit on free microsoft hosted agents.</p>
  <p>To get round this issue, I have set another task to run in event of the import failure, which picks up the the import/export database status and continues once it is marked as complete.</p>
  <p>To do this, I have created an output variable for the new-azsqldatabaseimport object, which is then passed as a parameter to the fail script to use.</p>
  <p>However, the problem I see is that when this runs, I get an error &quot;The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input&quot;</p>
  <p>To clarify, on the first pass where the $importdb variable is initially defined, the getstatus function works fine.</p>
  <p>I can see the value is being brought in (although it doesn't show me the actual value, but the details of the object, i.e  Microsoft.Azure.Commands.Sql.ImportExport.Model.AzureSqlDatabaseImportModel), I have also not defined the type of variable for the parameter in the powershell script.  But it still does not work.  These are the steps I am using:</p>
  <p><em>[In main import task]</em></p>
  <p>$importdb = New-AzSqlDatabaseImport [database parameters]</p>
  <p>write-host &quot;##vso[task.setvariable variable=Importdbname;IsOutput=true]$importdb&quot;</p>
  <p><em>[in failure catch task]</em></p>
  <p>Importdbstring: $[ dependencies.ImportDB.outputs['Importdb1.Importdbname'] ]</p>
  <p>-<em>variable passed as parameter to powershell script, used as below</em></p>
  <p>[parameter(Mandatory=$false)] $importingdb=''</p>
  <p>$importdb=$importingdb</p>
  <p>while (($importdb | Get-AzSqlDatabaseImportExportStatus).Status -eq 'InProgress){....}</p>
  <p>Can anyone offer any advice how to make this work? (apart from using premium DBs or paid agents)</p>