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

Fix C# + SQL Azure template #550

Merged
merged 2 commits into from
Sep 1, 2022
Merged

Conversation

karolz-ms
Copy link
Contributor

A bigger change than just the template because we need to add password-generation capability to AZD (for Bicep). Note that if we decide to have an equivalent Terraform template, no extra work will be necessary because Terraform already has password generation built-in.

The changes to deployment provider (renaming Preview() to Prepare() method and having Deploy() take a PreparedDeployment is something @ellismg @HadwaAbdelhalem and @wbreza discussed offline.

I will need some help with making this template subject to automated tests and flipping the corresponding repo to public--TIA!

Fixes #450

@karolz-ms
Copy link
Contributor Author

Manual test completed, no issues found

Copy link
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates look great, just not sold on the names.

cli/azd/pkg/cmdsubst/cmdsubst.go Outdated Show resolved Hide resolved
cli/azd/pkg/infra/provisioning/bicep_provider.go Outdated Show resolved Hide resolved
cli/azd/pkg/infra/provisioning/bicep_provider.go Outdated Show resolved Hide resolved
cli/azd/pkg/infra/provisioning/provider.go Outdated Show resolved Hide resolved
cli/azd/pkg/infra/provisioning/bicep_provider.go Outdated Show resolved Hide resolved
Copy link
Member

@ellismg ellismg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small questions about what happens if you end up running provision multiple times. I will admit that I am both excited and scared by the command running technology we are adding, but I can't really think of a better way to do this (all my solutions look like use uniqueString so we end up with something "unguessable" but it would be easy to compute if you knew all the inputs, which doesn't seem great).

Thinking about what this would look like in TF or Pulumi, as you mention we'd have the random resource there and it would be used to generate a password, but critically, the output would be stored in the state file and not change run to run.

Part of me wonders if we should be using [randomPassword()] instead of $(randomPassword) since that's closer to ARM syntax, but that's pretty bike-sheddy.

cli/azd/pkg/password/shuffle.go Outdated Show resolved Hide resolved
@karolz-ms
Copy link
Contributor Author

(need to do some testing, do not merge)

@karolz-ms
Copy link
Contributor Author

Tested the new template and command, all looks good. @ellismg please review again!

Adds password generation capability to AZD CLI
Copy link
Member

@ellismg ellismg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions - I feel most strongly about us not enumerating the existing KeyVault resources from the deployment if we can, I think that's possible and reasonable to do now that we pass the KeyVault name as a parameter to secretOrRandomPassword in but if I'm missing something let me know.

cli/azd/pkg/infra/provisioning/bicep_provider.go Outdated Show resolved Hide resolved
cli/azd/pkg/cmdsubst/cmdsubst.go Show resolved Hide resolved
cli/azd/pkg/cmdsubst/secretOrRandomPassword.go Outdated Show resolved Hide resolved
cli/azd/pkg/cmdsubst/secretOrRandomPassword.go Outdated Show resolved Hide resolved
cli/azd/pkg/cmdsubst/secretOrRandomPassword.go Outdated Show resolved Hide resolved
@azure-sdk
Copy link
Collaborator

Repoman Generation Results

Repoman pushed changes to remotes for the following projects:

Project: todo-csharp-sql

Remote: azure-samples-staging

Branch: pr/550

You can initialize this project with:

azd init -t Azure-Samples/todo-csharp-sql -b pr/550

View Changes | Compare Changes


@azure-sdk
Copy link
Collaborator

Azure Dev CLI Install Instructions

Install scripts

MacOS/Linux

May elevate using sudo on some platforms and configurations

bash:

curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550/uninstall-azd.sh | bash;
curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550/install-azd.sh | bash -s -- --base-url https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550 --version '' --verbose

pwsh:

Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550' -Version '' -Verbose

Windows

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/550' -Version '' -Verbose;"

Standalone Binary

Container

docker run -it azdevcliextacr.azurecr.io/azure-dev:pr-550

Copy link
Member

@ellismg ellismg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Thanks for this, Karol. I really enjoyed collaborating with you on the design and I think what we ended up with is pretty great and solve a real pain point in a very good way.

@karolz-ms karolz-ms merged commit 24cac12 into Azure:main Sep 1, 2022
@karolz-ms
Copy link
Contributor Author

Thank you, Matt, your suggestions and collaboration made it way better than what I could have come up with on my own!

@karolz-ms karolz-ms deleted the csharp-azure-sql3 branch September 1, 2022 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix and publish C# + Azure SQL application template
5 participants