Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-WinGetSource does not work due to missing template files #175

Open
ghost opened this issue Sep 27, 2022 · 7 comments
Open

New-WinGetSource does not work due to missing template files #175

ghost opened this issue Sep 27, 2022 · 7 comments
Assignees
Labels
Issue-Docs Improvements or additions to documentation

Comments

@ghost
Copy link

ghost commented Sep 27, 2022

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
@ghost
Copy link
Author

ghost commented Sep 28, 2022

I've been spending a lot of time looking through the pipeline YAML files, and there's a lot that's done there that's not done when building locally. These steps are critical for the cmdlets to actually work. I'll add more details as I continue to work through this.

@denelon denelon added the Issue-Docs Improvements or additions to documentation label Sep 29, 2022
@ghost
Copy link
Author

ghost commented Oct 4, 2022

After spending many hours working on this, I was unsuccessful in getting the automated approach to work and just finally went with a completely manual approach as outlined in the new-winget-rest-source-azure.md document.

This isn't only a doc issue, there's bugs in the cmdlet itself and there's files (such as asp.json) that are missing completely.

@RDMacLachlan
Copy link
Member

Hi @ameltzerMSFT, we appreciate the feedback on your experience. I will be looking through your different Issue's that you've logged from your experience and see what we can do to improve upon the experience.

@ghost
Copy link
Author

ghost commented Oct 5, 2022

Thanks! I was trying to get this to work building/running from source versus trying the released module which may be in a different functional state.

@RDMacLachlan
Copy link
Member

The PowerShell Module has a dependency on a HelperLib file that is used by another section of code in the project. So, to ensure the experience is shared across two separate tools we include a copy of the HelperLib in the Released PowerShell Module.

Sorry for the confusion when trying to use the PowerShell scripts.

@jmservera
Copy link
Member

jmservera commented Jan 31, 2023

After spending many hours working on this, I was unsuccessful in getting the automated approach to work and just finally went with a completely manual approach as outlined in the new-winget-rest-source-azure.md document.

This isn't only a doc issue, there's bugs in the cmdlet itself and there's files (such as asp.json) that are missing completely.

I downloaded the last release and followed the step by step many times, but I still get the issue, it asks for a manifestCacheEndPoint value and when looking at the $Error shows that the asp.json is missing:

PS C:\> New-WinGetSource -Name "jmrestsource" -ResourceGroup "WinGet" -Region "northeurope" -ImplementationPerformance "Demo" -ShowConnectionInstructionswConnectionInstructions
WARNING:
 The "Demo" build creates the Azure Cosmos DB Account with the "Free-tier" option selected which offset the total cost. Only 1 Cosmos DB Account per tenant can make use of this.


True

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

Test-AzResourceGroupDeployment: C:\Users\juanserv\Downloads\WinGet.RestSource-Winget.PowerShell.Source\WinGet.RestSource-Winget.PowerShell.Source\Library\Test-ARMTemplate.ps1:44
Line |
  44 |  … rceResult = Test-AzResourceGroupDeployment -ResourceGroupName $Resour|                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot retrieve the dynamic parameters for the cmdlet. Cannot find path
     | 'C:\Users\juanserv\Downloads\WinGet.RestSource-Winget.PowerShell.Source\WinGet.RestSource-Winget.PowerShell.Source\Library\ARMTemplate\asp.json' because it does not exist.


Get-AzResourceGroup: C:\Users\juanserv\Downloads\WinGet.RestSource-Winget.PowerShell.Source\WinGet.RestSource-Winget.PowerShell.Source\Library\Add-AzureResourceGroup.ps1:62
Line |
  62 |$Result = Get-AzResourceGroup -Name $Name -ErrorAction SilentlyCont …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 9:23:36 AM - Provided resource group does not exist.


Get-Process: A positional parameter cannot be found that accepts argument 'Get-ChildItem'.

But if I look into the generated Parameters file, there's an asp.json file there:

ls .\Parameters\

    Directory: C:\temp\Parameters

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           1/31/2023  9:32 AM            214 applicationinsights.json
-a---           1/31/2023  9:32 AM            375 asp.json
-a---           1/31/2023  9:32 AM            729 azurefunction.json
-a---           1/31/2023  9:32 AM            928 cosmosdb-sql-container.json
-a---           1/31/2023  9:32 AM            400 cosmosdb-sql.json
-a---           1/31/2023  9:32 AM           1609 cosmosdb.json
-a---           1/31/2023  9:32 AM            679 keyvault.json
-a---           1/31/2023  9:32 AM            346 storageaccount.json

Should the command be run in a specific path?

I downloaded the latest script version in 1.1.20230126 and my current versions are:

PS C:\> $PSVersionTable.PSVersion                                                                                                                                                                                                                                        
Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      3      2

PS C:\> (get-module Az).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
9      3      0      -1

PS C:\> (get-module Microsoft.WinGet.Source).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
0      1      0      -1

And if I just ignore the errors, some resources are deployed, but the Function App is missing:
image

@gunnim
Copy link

gunnim commented Mar 23, 2023

Managed to beat the powershell azure setup scripts into submission and have some step-by-step instructions for usage of that and upload of package afterwards.

https://github.com/gunnim/winget-restsource

HTH !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants