Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from azure.keyvault.secrets import SecretClient
|
|
4 |
|
5 |
# Define Azure Key Vault and Secret Name
|
6 |
azure_key_vault_url = "https://your-keyvault-name.vault.azure.net/"
|
7 |
-
secret_name = "your-secret-name"
|
8 |
|
9 |
# Initialize Azure credential
|
10 |
credential = DefaultAzureCredential()
|
@@ -16,14 +16,16 @@ secret_client = SecretClient(vault_url=azure_key_vault_url, credential=credentia
|
|
16 |
st.title("Azure Authentication Example")
|
17 |
|
18 |
# Authenticate to Azure Key Vault
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
# Display secret value
|
26 |
if secret_value:
|
|
|
27 |
st.write(f"The secret value from Azure Key Vault is: {secret_value}")
|
28 |
|
29 |
# Optional: You can add more Streamlit components and functionality as needed
|
|
|
4 |
|
5 |
# Define Azure Key Vault and Secret Name
|
6 |
azure_key_vault_url = "https://your-keyvault-name.vault.azure.net/"
|
7 |
+
secret_name = st.text_input("Enter Secret Name:", value="your-secret-name")
|
8 |
|
9 |
# Initialize Azure credential
|
10 |
credential = DefaultAzureCredential()
|
|
|
16 |
st.title("Azure Authentication Example")
|
17 |
|
18 |
# Authenticate to Azure Key Vault
|
19 |
+
if st.button("Authenticate", emoji="🔒"):
|
20 |
+
try:
|
21 |
+
secret_value = secret_client.get_secret(secret_name).value
|
22 |
+
st.success("Successfully authenticated to Azure Key Vault.")
|
23 |
+
except Exception as e:
|
24 |
+
st.error(f"Authentication failed: {str(e)}")
|
25 |
|
26 |
# Display secret value
|
27 |
if secret_value:
|
28 |
+
st.subheader("Secret Value")
|
29 |
st.write(f"The secret value from Azure Key Vault is: {secret_value}")
|
30 |
|
31 |
# Optional: You can add more Streamlit components and functionality as needed
|