microsoft / microsoft/winget-cli-restsource

New-WinGetSource does not work due to missing template files

Open
#175 7 comments 0 reactions 1 assignee View on GitHub

@RDMacLachlan is already working on this.

Since Sep 29, 2022.

Issue-Docs
Dominant language
C#
Stars
317
Forks
79
PR merge metrics
No merged PRs in 30d

Description

After manually working around the issues in #171, #172, #173, and #174 I attempted to install a new WinGetSource per the documentation. It failed at multiple points, each which required manual workarounds. Even after spending hours on this it's still not able to run successfully end to end. I'll continue to update this Issue as I work through these things to document progress.

I attempted to run the cmdlet using the following syntax: new-wingetsource -name winget -ResourceGroup WinGetTest -SubscriptionName "SUBSCRIPTION_NAME" -Region westus which failed without much useful text. Verbose logging also wasn't super helpful:

PS D:\b\winget-cli-restsource\Tools\PowershellModule\src> new-wingetsource -name winget -ResourceGroup WinGetTest -SubscriptionName "SUBSCRIPTION_NAME" -Region westus          
VERBOSE: Testing required PowerShell modules are installed.
VERBOSE: Populating RepositorySourceLocation property for module Az.Resources.
VERBOSE: Populating RepositorySourceLocation property for module Az.Accounts.
VERBOSE: Populating RepositorySourceLocation property for module Az.Accounts.
VERBOSE: Populating RepositorySourceLocation property for module Az.Websites.
VERBOSE: Populating RepositorySourceLocation property for module Az.Functions.
VERBOSE: Testing connection to Azure.
VERBOSE: Connected to Azure
VERBOSE: Verifying if PowerShell session is currently connected to your Azure Subscription Name SUBSCRIPTION_NAME
VERBOSE: Connected to Azure
VERBOSE: Connection Result: True
VERBOSE: ARM Parameter Resource performance is based on the: Basic.
VERBOSE: Retrieving the Azure Tenant and User Id Information
VERBOSE: Retrieved the Azure Tenant Id: TENANT_ID
VERBOSE: Retrieved the Azure Object Id: 30236b7b-91f8-4ff5-9d07-116ff9ad62ec
VERBOSE: Validating that the inputs for the AppInsights template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the Keyvault template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the StorageAccount template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the asp template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the CosmosDBAccount template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the CosmosDBDatabase template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the CosmosDBContainer template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Validating that the inputs for the Function template are not null.
VERBOSE:     inputs are not null.
VERBOSE: Creating JSON Parameter files for Azure Object Creation:
VERBOSE:   Creating the Parameter file for AppInsight in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\applicationinsights.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "Name": {
      "value": "winget"
    }
  }
})
VERBOSE:   Creating the Parameter file for Keyvault in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\keyvault.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "sku": {
      "value": "Standard"
    },
    "accessPolicies": {
      "value": [
        {
          "permissions": {
            "secrets": [
              "Get",
              "Set"
            ],
            "certificates": [],
            "keys": []
          },
          "objectID": "30236b7b-91f8-4ff5-9d07-116ff9ad62ec",
          "tenantId": "TENANT_ID"
        }
      ]
    },
    "name": {
      "type": "string",
      "value": "winget"
    }
  }
})
VERBOSE:   Creating the Parameter file for StorageAccount in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\storageaccount.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "storageAccountName": {
      "value": "winget"
    },
    "accountType": {
      "value": "Standard_GRS"
    },
    "location": {
      "value": "westus"
    }
  }
})
VERBOSE:   Creating the Parameter file for asp in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\asp.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "numberOfWorkers": {
      "value": "1"
    },
    "skuCode": {
      "value": "S1"
    },
    "aspName": {
      "value": "winget"
    },
    "location": {
      "value": "westus"
    }
  }
})
VERBOSE:   Creating the Parameter file for CosmosDBAccount in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\cosmosdb.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "consistencyPolicy": {
      "value": {
        "maxStalenessPrefix": 100,
        "maxIntervalInSeconds": 5,
        "defaultConsistencyLevel": "ConsistentPrefix"
      }
    },
    "name": {
      "value": "winget"
    },
    "backupPolicy": {
      "value": {
        "type": "Periodic",
        "periodicModeProperties": {
          "backupRetentionIntervalInHours": 720,
          "backupIntervalInMinutes": 240
        }
      }
    },
    "ipRules": {
      "value": [
        {
          "ipAddressOrRange": "104.42.195.92"
        },
        {
          "ipAddressOrRange": "40.76.54.131"
        },
        {
          "ipAddressOrRange": "52.176.6.30"
        },
        {
          "ipAddressOrRange": "52.169.50.45"
        },
        {
          "ipAddressOrRange": "52.187.184.26"
        },
        {
          "ipAddressOrRange": "0.0.0.0"
        }
      ]
    },
    "enableFreeTier": {
      "value": false
    },
    "locations": {
      "value": [
        {
          "failoverPriority": 0,
          "locationName": "West US",
          "isZoneRedundant": false
        },
        {
          "failoverPriority": 1,
          "locationName": "East US",
          "isZoneRedundant": false
        }
      ]
    },
    "tags": {
      "value": {
        "CosmosAccountType": "Production",
        "defaultExperience": "Core (SQL)"
      }
    }
  }
})
VERBOSE:   Creating the Parameter file for CosmosDBDatabase in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\cosmosdb-sql.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "sqlname": {
      "value": "WinGet"
    },
    "options": {
      "Value": {
        "autoscaleSettings": {
          "maxThroughput": 4000
        }
      }
    },
    "cosmosName": {
      "value": "winget"
    }
  }
})
VERBOSE:   Creating the Parameter file for CosmosDBContainer in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\cosmosdb-sql-container.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "conflictResolutionPolicy": {
      "value": {
        "mode": "LastWriterWins",
        "conflictResolutionPath": "/_ts"
      }
    },
    "cosmosName": {
      "Value": "winget"
    },
    "containerName": {
      "value": "Manifests"
    },
    "indexingPolicy": {
      "Value": {
        "excludePaths": [
          {
            "path": "/\"_etag\"/?"
          }
        ],
        "includedPaths": [
          {
            "path": "/*"
          }
        ],
        "IndexingMode": "consistent",
        "automatic": true
      }
    },
    "partitionKey": {
      "value": {
        "kind": "Hash",
        "paths": [
          "/id"
        ]
      }
    },
    "sqlname": {
      "Value": "WinGet"
    }
  }
})
VERBOSE:   Creating the Parameter file for Function in the following location:
    D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\azurefunction.json
VERBOSE: Parameter file: ({
  "$Schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "Parameters": {
    "cosmosDatabase": {
      "value": "WinGet"
    },
    "appInsightName": {
      "value": "winget"
    },
    "storageSecretName": {
      "value": "AzStorageAccountKey"
    },
    "appServiceName": {
      "value": "winget"
    },
    "keyVaultName": {
      "value": "winget"
    },
    "location": {
      "value": "westus"
    },
    "serverIdentifier": {
      "value": "winget"
    },
    "cosmosContainer": {
      "value": "Manifests"
    },
    "functionName": {
      "value": "winget"
    }
  }
})
VERBOSE: Creating the Resource Group used to host the Windows Package Manager REST source.
VERBOSE: Azure Resource Group Name to be created: WinGetTest
VERBOSE: Retrieving details from Azure for the Resource Group Name WinGetTest
VERBOSE: Resource Group does not exist, will create WinGetTest in the specified westus.
VERBOSE: 12:33:36 - Created resource group 'WinGetTest' in location 'westus'
True
VERBOSE: Name is already in use.
VERBOSE:   Name within Length:         True
VERBOSE:   No Special Chars:           True
VERBOSE:   Doesn't start with Num:     True
VERBOSE:   No consecutive hyphens:     True
VERBOSE: Name is already in use.
VERBOSE:   Name within length:         True
VERBOSE:   No special chars:           True
VERBOSE:   No upper case chars:        True
VERBOSE:   No spaces:                  True
VERBOSE: Name is already in use.
VERBOSE:   No spaces:                  True
VERBOSE: Name is already in use.
VERBOSE: Name is already in use.
VERBOSE: Name is already in use.
VERBOSE: Name is already in use.
VERBOSE:   Name within Length:         True
VERBOSE:   No Special Chars:           True
VERBOSE: Name is already in use.
New-WinGetSource: Testing found an error with the ARM template or parameter files.
New-WinGetSource: ARM Template and Parameter testing failed


Name                           Value
----                           -----
ObjectType                     AppInsight
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\applicationinsights.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     winget
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\applicationinsights.json
ObjectType                     Keyvault
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\keyvault.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     winget
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\keyvault.json
ObjectType                     StorageAccount
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\storageaccount.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     winget
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\storageaccount.json
ObjectType                     asp
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\asp.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     winget
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\asp.json
ObjectType                     CosmosDBAccount
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\cosmosdb.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     winget
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb.json
ObjectType                     CosmosDBDatabase
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\cosmosdb-sql.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     WinGet
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql.json
ObjectType                     CosmosDBContainer
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\cosmosdb-sql-container.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     Manifests
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql-container.json
ObjectType                     Function
ParameterPath                  D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters\azurefunction.json
Parameters                     {$Schema, contentVersion, Parameters}
ObjectName                     winget
Error
TemplatePath                   D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\azurefunction.json

The text:

New-WinGetSource: Testing found an error with the ARM template or parameter files.
New-WinGetSource: ARM Template and Parameter testing failed

Contains hints, but nothing actionable. There were no warnings or errors output to the console (which I later learned is because -ErrorAction SilentlyContinue is used liberally throughout the code which means failures are hidden unless you dig for them).

Even though errors were suppressed, they were still stored in $Error for further inspection:

PS D:\b\winget-cli-restsource\Tools\PowershellModule\src> $Error

New-WinGetSource: ARM Template and Parameter testing failed


New-WinGetSource: Testing found an error with the ARM template or parameter files.

Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Function name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\azurefunction.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBContainer name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql-container.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBDatabase name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBAccount name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | asp name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\asp.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | StorageAccount name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\storageaccount.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Keyvault name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\keyvault.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | AppInsight name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\applicationinsights.json' because it does not exist.


Get-AzResourceGroup: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Add-AzureResourceGroup.ps1:62:19
Line |
  62 |  …   $Result = Get-AzResourceGroup -Name $Name -ErrorAction SilentlyCont …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 12:33:34 - Provided resource group does not exist.


New-Item: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:107:28
Line |
 107 |  … Parameter = New-Item -ItemType Directory -Path $ParameterFolderPath - …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | An item with the specified name D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters already exists.


New-WinGetSource: ARM Template and Parameter testing failed


New-WinGetSource: Testing found an error with the ARM template or parameter files.

Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Function name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\azurefunction.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBContainer name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql-container.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBDatabase name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBAccount name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | asp name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\asp.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | StorageAccount name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\storageaccount.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Keyvault name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\keyvault.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | AppInsight name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\applicationinsights.json' because it does not exist.


Get-AzResourceGroup: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Add-AzureResourceGroup.ps1:62:19
Line |
  62 |  …   $Result = Get-AzResourceGroup -Name $Name -ErrorAction SilentlyCont …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 12:32:41 - Provided resource group does not exist.


New-Item: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:107:28
Line |
 107 |  … Parameter = New-Item -ItemType Directory -Path $ParameterFolderPath - …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | An item with the specified name D:\b\winget-cli-restsource\Tools\PowershellModule\src\Parameters already exists.


New-WinGetSource: ARM Template and Parameter testing failed


New-WinGetSource: Testing found an error with the ARM template or parameter files.

Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Function name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\azurefunction.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBContainer name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql-container.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBDatabase name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb-sql.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | CosmosDBAccount name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\cosmosdb.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | asp name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\asp.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | StorageAccount name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\storageaccount.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Keyvault name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\keyvault.json' because it does not exist.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:132:19
Line |
 132 |  …   $Result = Test-ARMTemplate -ARMObjects $ARMObjects -ResourceGroup $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | AppInsight name is already in use, or there is an error with the Parameter file


Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\applicationinsights.json' because it does not exist.

This actually has some really useful information. Indeed, there is no %REPOROOT%\Tools\PowershellModule\src\Library\ARMTemplate path that's been created, which is why these things are silently failing.

Looking through the repo sources, I found what appears to be all the necessary JSON templates under %REPOROOT%\src\WinGet.RestSource.Infrastructure\Templates. I copied all these files to %REPOROOT%\Tools\PowerShellModule\src\Library\ARMTemplate and flattened them into a single directory.

On re-run, the script got further (partial output):

cmdlet Test-AzResourceGroupDeployment at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
manifestCacheEndpoint:

I debugged into Test-ARMTemplates and discovered that the generated %REPOROOT%\Tools\PowerShellModule\src\Parameters\azurefunction.json file was missing a bunch of required data:

  • manifestCacheEndpoint
  • monitoringTenant
  • monitoringRole
  • monitoringMetricsAccount

Ignoring these caused a failure in creating the function. Setting these to empty or dummy values proceeded further, which then failed at the asp step:

Test-AzResourceGroupDeployment: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\Test-ARMTemplate.ps1:44:33
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path 'D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\ARMTemplate\asp.json' because it does not exist.

Looking through the entire repo, there doesn't appear to be any asp.json template file.

Ignoring this, the cmdlet then failed at creating the KeyVault because it already existed in some other Azure subscription.


Write-Error: D:\b\winget-cli-restsource\Tools\PowershellModule\src\Library\New-WinGetSource.ps1:157:9
Line |
 157 |          New-ARMObjects -ARMObjects $ARMObjects -RestSourcePath $RestS …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Failed to create Azure object. 13:41:53 - The deployment 'keyvault' failed with error(s). Showing 1 out of 1 error(s). Status Message: The vault name 'winget' is already in use. Vault names are globaly unique
     | so it is possible that the name is already taken. If you are sure that the vault name was not taken then it is possible that a vault with the same name was recently deleted but not purged after being placed
     | in a recoverable state. If the vault is in a recoverable state then the vault will need to be purged before reusing the name. For more information on soft delete and purging a vault follow this link
     | https://go.microsoft.com/fwlink/?linkid=2147740. (Code:VaultAlreadyExists)  CorrelationId: 2b72b975-4131-4405-a495-42cb355f656b

New-WinGetSource: Testing found an error with the ARM template or parameter files.

There's no way in the cmdlet to work around this, so I had to re-run with an entirely new -Name parameter to something that I could ensure would be globally unique for KV creation.

After all this the script finally ran to completion (after prompting me 2 more times for the missing azurefunction.json template parameter values) with these immediate issues apparent:

  • ASP role missing
  • Azure Function creation failed because %REPOROOT%\Tools\PowershellModule\src\Library\RestAPI\WinGet.RestSource.Functions.zip file was not present.

Looking through the entire repo including built files, there is no WinGet.RestSource.Functions.zip file. There is no mention in the README.md about how to create this file.

Current Status

I will continue working on this and update this Issue as I progress.

I've given up on the automation and have instead gone with manual installation as outlined in the new-winget-rest-source-azure.md document. Even after multiple attempts to get the automation to run successfully by fixing bugs, fixing templates, and attempting to add the missing asp.json template, the creation of resources was ultimately incorrect and unusable.

Summary

To summarize, when trying to follow the documentation and run this cmdlet I've run into the following problems:

  • Errors are widely suppressed making it non-obvious why things might not be working
  • Errors that are not suppressed have little context into what's failing and why
  • Template files are missing from the expected default path, and the build process does not copy them to the expected path
  • Azure Functions .zip file is not in the expected default path, and the build process does not create it
  • Parameter generation is missing expected values for the Azure Function template
  • ASP template is missing entirely which blocks the script from completing successfully
  • KeyVault creation keys only off the -Name parameter value which may conflict globally
  • At no point when the cmdlet completed did the output hashtable have any "Error" values populated with details about what may/may not have failed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.