Closed andrew-kelleher closed 2 years ago
@Xynoclafe - this is similar to the error we ran into in earlier release but I don't remember the fix/workaround... do we have to remove-module az.resources
prior to install in this case?
I suspect the Az.Resources module is being loaded into the session before the new modules version is installed/loaded. Removing it should fix the problem, as long as no cmdlet from Az.Resources is being run before the installation of new modules is completed.
@andrew-kelleher - have you had a chance to try this by ensuring the [default] module is not already loaded on the box?
@bmoore-msft no, I've not had an opportunity to test this yet.
Now that the Deployment Stacks AZ CLI cmds are available in the latest preview we're likely going to focus our testing there. The AZ CLI tends to align much better with what we're doing with our Linux build agents and pipelines.
Feel free to close this issue unless it'd help anyone else.
Sounds good - feel free to open/comment as needed...
Has anyone managed to create an Azure DevOps pipeline that installs and runs the Deployment Stack preview cmdlets on a Microsoft-hosted Ubuntu build agent?
I almost have it working but am hitting an issue with running the cmdlets within the pipeline. They simply return an error such as -
The 'Get-AzSubscriptionDeploymentStack' command was found in the module 'Az.Resources', but the module could not be loaded
I've customized the downloaded installation zip file such that it's non-interactive and performs a system-wide installation. This is then added to our repo, unzipped and installed as part of the pipeline.
Example pipeline yaml
The pipeline yaml I'm currently using is -
Both of the install steps complete successfully. Within the last verify step
get-module
is showing that the az.resources v9.0.1 module containing the Deployment Stack cmdlets is installed.However it then fails attempting to run the
Get-AzSubscriptionDeploymentStack
cmdlet with -The 'Get-AzSubscriptionDeploymentStack' command was found in the module 'Az.Resources', but the module could not be loaded
If I add
Import-module az.resources -version 9.0.1
prior toGet-AzSubscriptionDeploymentStack
I receive the following error -Does anyone have ideas or an alternative approach to getting the Deployment Stack cmdlets working in a pipeline?
I appreciate that as this moves out of preview the installation will be much cleaner and this should just work natively. But in the meantime we're keen to see how Deployment Stacks can be integrated into our existing pipelines.
Thanks!